mirror of https://github.com/commaai/panda.git
merge safety gm in a single file
This commit is contained in:
parent
bf1ef875ee
commit
14ea4d2e07
|
@ -8,7 +8,6 @@
|
|||
#include "safety/safety_tesla.h"
|
||||
#include "safety/safety_gm_ascm.h"
|
||||
#include "safety/safety_gm.h"
|
||||
#include "safety/safety_gm_passive.h"
|
||||
#include "safety/safety_ford.h"
|
||||
#include "safety/safety_cadillac.h"
|
||||
#include "safety/safety_hyundai.h"
|
||||
|
|
|
@ -231,6 +231,20 @@ static int gm_ign_hook(void) {
|
|||
return gm_ignition_started;
|
||||
}
|
||||
|
||||
// All sending is disallowed.
|
||||
// The only difference from "no output" model
|
||||
// is using GM ignition hook.
|
||||
|
||||
static void gm_passive_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
int bus_number = GET_BUS(to_push);
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
if ((addr == 0x1F1) && (bus_number == 0)) {
|
||||
bool ign = (GET_BYTE(to_push, 0) & 0x20) != 0;
|
||||
gm_ignition_started = ign;
|
||||
}
|
||||
}
|
||||
|
||||
const safety_hooks gm_hooks = {
|
||||
.init = gm_init,
|
||||
.rx = gm_rx_hook,
|
||||
|
@ -239,3 +253,12 @@ const safety_hooks gm_hooks = {
|
|||
.ignition = gm_ign_hook,
|
||||
.fwd = default_fwd_hook,
|
||||
};
|
||||
|
||||
const safety_hooks gm_passive_hooks = {
|
||||
.init = gm_init,
|
||||
.rx = gm_passive_rx_hook,
|
||||
.tx = nooutput_tx_hook,
|
||||
.tx_lin = nooutput_tx_lin_hook,
|
||||
.ignition = gm_ign_hook,
|
||||
.fwd = default_fwd_hook,
|
||||
};
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
// All sending is disallowed.
|
||||
// The only difference from "no output" model
|
||||
// is using GM ignition hook.
|
||||
|
||||
static void gm_passive_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||
int bus_number = GET_BUS(to_push);
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
if ((addr == 0x1F1) && (bus_number == 0)) {
|
||||
bool ign = (GET_BYTE(to_push, 0) & 0x20) != 0;
|
||||
gm_ignition_started = ign;
|
||||
}
|
||||
}
|
||||
|
||||
const safety_hooks gm_passive_hooks = {
|
||||
.init = gm_init,
|
||||
.rx = gm_passive_rx_hook,
|
||||
.tx = nooutput_tx_hook,
|
||||
.tx_lin = nooutput_tx_lin_hook,
|
||||
.ignition = gm_ign_hook,
|
||||
.fwd = default_fwd_hook,
|
||||
};
|
Loading…
Reference in New Issue