2019-12-21 02:25:54 -07:00
|
|
|
int default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
2019-06-24 11:25:30 -06:00
|
|
|
UNUSED(to_push);
|
2019-12-21 02:25:54 -07:00
|
|
|
return true;
|
2019-06-24 11:25:30 -06:00
|
|
|
}
|
2017-07-17 11:20:08 -06:00
|
|
|
|
|
|
|
// *** no output safety mode ***
|
|
|
|
|
2018-01-26 00:57:04 -07:00
|
|
|
static void nooutput_init(int16_t param) {
|
2019-06-24 11:25:30 -06:00
|
|
|
UNUSED(param);
|
2019-11-15 01:32:45 -07:00
|
|
|
controls_allowed = false;
|
2020-04-09 16:53:46 -06:00
|
|
|
relay_malfunction_reset();
|
2017-07-17 11:20:08 -06:00
|
|
|
}
|
|
|
|
|
2017-07-21 00:36:06 -06:00
|
|
|
static int nooutput_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
|
2019-06-24 11:25:30 -06:00
|
|
|
UNUSED(to_send);
|
2017-07-17 11:20:08 -06:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-07-21 00:36:06 -06:00
|
|
|
static int nooutput_tx_lin_hook(int lin_num, uint8_t *data, int len) {
|
2019-06-24 11:25:30 -06:00
|
|
|
UNUSED(lin_num);
|
|
|
|
UNUSED(data);
|
|
|
|
UNUSED(len);
|
2017-07-17 11:20:08 -06:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-06-11 20:50:12 -06:00
|
|
|
static int default_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
|
2019-06-24 11:25:30 -06:00
|
|
|
UNUSED(bus_num);
|
|
|
|
UNUSED(to_fwd);
|
2018-02-28 00:27:47 -07:00
|
|
|
return -1;
|
|
|
|
}
|
2018-04-10 18:55:55 -06:00
|
|
|
|
2017-07-17 11:20:08 -06:00
|
|
|
const safety_hooks nooutput_hooks = {
|
|
|
|
.init = nooutput_init,
|
|
|
|
.rx = default_rx_hook,
|
|
|
|
.tx = nooutput_tx_hook,
|
|
|
|
.tx_lin = nooutput_tx_lin_hook,
|
2019-06-11 20:50:12 -06:00
|
|
|
.fwd = default_fwd_hook,
|
2017-07-17 11:20:08 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
// *** all output safety mode ***
|
|
|
|
|
2018-01-26 00:57:04 -07:00
|
|
|
static void alloutput_init(int16_t param) {
|
2019-06-24 11:25:30 -06:00
|
|
|
UNUSED(param);
|
2019-11-15 01:32:45 -07:00
|
|
|
controls_allowed = true;
|
2020-04-09 16:53:46 -06:00
|
|
|
relay_malfunction_reset();
|
2017-07-17 11:20:08 -06:00
|
|
|
}
|
|
|
|
|
2017-07-21 00:36:06 -06:00
|
|
|
static int alloutput_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
|
2019-06-24 11:25:30 -06:00
|
|
|
UNUSED(to_send);
|
2017-07-21 00:36:06 -06:00
|
|
|
return true;
|
2017-07-17 11:20:08 -06:00
|
|
|
}
|
|
|
|
|
2017-07-21 00:36:06 -06:00
|
|
|
static int alloutput_tx_lin_hook(int lin_num, uint8_t *data, int len) {
|
2019-06-24 11:25:30 -06:00
|
|
|
UNUSED(lin_num);
|
|
|
|
UNUSED(data);
|
|
|
|
UNUSED(len);
|
2017-07-21 00:36:06 -06:00
|
|
|
return true;
|
2017-07-17 11:20:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
const safety_hooks alloutput_hooks = {
|
|
|
|
.init = alloutput_init,
|
|
|
|
.rx = default_rx_hook,
|
|
|
|
.tx = alloutput_tx_hook,
|
|
|
|
.tx_lin = alloutput_tx_lin_hook,
|
2019-06-11 20:50:12 -06:00
|
|
|
.fwd = default_fwd_hook,
|
2017-07-17 11:20:08 -06:00
|
|
|
};
|