forked from commaai/panda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsafety_defaults.h
44 lines (33 loc) · 897 Bytes
/
safety_defaults.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
void default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {}
// *** no output safety mode ***
static void nooutput_init() {
controls_allowed = 0;
}
static int nooutput_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
return false;
}
static int nooutput_tx_lin_hook(int lin_num, uint8_t *data, int len) {
return false;
}
const safety_hooks nooutput_hooks = {
.init = nooutput_init,
.rx = default_rx_hook,
.tx = nooutput_tx_hook,
.tx_lin = nooutput_tx_lin_hook,
};
// *** all output safety mode ***
static void alloutput_init() {
controls_allowed = 1;
}
static int alloutput_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
return true;
}
static int alloutput_tx_lin_hook(int lin_num, uint8_t *data, int len) {
return true;
}
const safety_hooks alloutput_hooks = {
.init = alloutput_init,
.rx = default_rx_hook,
.tx = alloutput_tx_hook,
.tx_lin = alloutput_tx_lin_hook,
};