Ignition: made a default hook for GPIO

master
Riccardo 2018-05-25 18:20:55 -07:00
parent bea51874e7
commit d176220c72
6 changed files with 13 additions and 32 deletions

View File

@ -1,5 +1,9 @@
void default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {}
int default_ign_hook() {
return -1; // use GPIO to determine ignition
}
// *** no output safety mode ***
static void nooutput_init(int16_t param) {
@ -14,9 +18,6 @@ static int nooutput_tx_lin_hook(int lin_num, uint8_t *data, int len) {
return false;
}
static int nooutput_ign_hook() {
return -1;
}
static int nooutput_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return -1;
}
@ -26,7 +27,7 @@ const safety_hooks nooutput_hooks = {
.rx = default_rx_hook,
.tx = nooutput_tx_hook,
.tx_lin = nooutput_tx_lin_hook,
.ignition = nooutput_ign_hook,
.ignition = default_ign_hook,
.fwd = nooutput_fwd_hook,
};
@ -44,10 +45,6 @@ static int alloutput_tx_lin_hook(int lin_num, uint8_t *data, int len) {
return true;
}
static int alloutput_ign_hook() {
return -1;
}
static int alloutput_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return -1;
}
@ -57,7 +54,7 @@ const safety_hooks alloutput_hooks = {
.rx = default_rx_hook,
.tx = alloutput_tx_hook,
.tx_lin = alloutput_tx_lin_hook,
.ignition = alloutput_ign_hook,
.ignition = default_ign_hook,
.fwd = alloutput_fwd_hook,
};

View File

@ -31,10 +31,6 @@ static void elm327_init(int16_t param) {
controls_allowed = 1;
}
static int elm327_ign_hook() {
return -1;
}
static int elm327_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return -1;
}
@ -44,6 +40,6 @@ const safety_hooks elm327_hooks = {
.rx = elm327_rx_hook,
.tx = elm327_tx_hook,
.tx_lin = elm327_tx_lin_hook,
.ignition = elm327_ign_hook,
.ignition = default_ign_hook,
.fwd = elm327_fwd_hook,
};

View File

@ -96,15 +96,11 @@ static int ford_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return -1;
}
static int ford_ign_hook() {
return -1;
}
const safety_hooks ford_hooks = {
.init = ford_init,
.rx = ford_rx_hook,
.tx = ford_tx_hook,
.tx_lin = ford_tx_lin_hook,
.ignition = ford_ign_hook,
.ignition = default_ign_hook,
.fwd = ford_fwd_hook,
};

View File

@ -134,16 +134,12 @@ static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return -1;
}
static int honda_ign_hook() {
return -1;
}
const safety_hooks honda_hooks = {
.init = honda_init,
.rx = honda_rx_hook,
.tx = honda_tx_hook,
.tx_lin = honda_tx_lin_hook,
.ignition = honda_ign_hook,
.ignition = default_ign_hook,
.fwd = honda_fwd_hook,
};
@ -165,6 +161,6 @@ const safety_hooks honda_bosch_hooks = {
.rx = honda_rx_hook,
.tx = honda_tx_hook,
.tx_lin = honda_tx_lin_hook,
.ignition = honda_ign_hook,
.ignition = default_ign_hook,
.fwd = honda_bosch_fwd_hook,
};

View File

@ -175,10 +175,6 @@ static void toyota_init(int16_t param) {
dbc_eps_torque_factor = param;
}
static int toyota_ign_hook() {
return -1;
}
static int toyota_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
return -1;
}
@ -188,7 +184,7 @@ const safety_hooks toyota_hooks = {
.rx = toyota_rx_hook,
.tx = toyota_tx_hook,
.tx_lin = toyota_tx_lin_hook,
.ignition = toyota_ign_hook,
.ignition = default_ign_hook,
.fwd = toyota_fwd_hook,
};
@ -203,6 +199,6 @@ const safety_hooks toyota_nolimits_hooks = {
.rx = toyota_rx_hook,
.tx = toyota_tx_hook,
.tx_lin = toyota_tx_lin_hook,
.ignition = toyota_ign_hook,
.ignition = default_ign_hook,
.fwd = toyota_fwd_hook,
};

View File

@ -180,7 +180,7 @@ const safety_hooks toyota_ipas_hooks = {
.rx = toyota_ipas_rx_hook,
.tx = toyota_ipas_tx_hook,
.tx_lin = toyota_tx_lin_hook,
.ignition = toyota_ign_hook,
.ignition = default_ign_hook,
.fwd = toyota_fwd_hook,
};