-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Commaremote
committed
May 25, 2018
1 parent
4e79ecf
commit 528f901
Showing
1 changed file
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,28 @@ | ||
int cadillac_ignition_started = 0; | ||
|
||
static void cadillac_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { | ||
int bus_number = (to_push->RDTR >> 4) & 0xFF; | ||
uint32_t addr = to_push->RIR >> 21; | ||
|
||
if (addr == 0x135 && bus_number == 0) { | ||
cadillac_ignition_started = 1; //as soona s we receive can msgs, ingition is on | ||
} | ||
} | ||
|
||
static void cadillac_init(int16_t param) { | ||
cadillac_ignition_started = 0; | ||
} | ||
|
||
static int cadillac_ign_hook() { | ||
return cadillac_ignition_started; | ||
} | ||
|
||
// Placeholder file, actual safety is TODO. | ||
const safety_hooks cadillac_hooks = { | ||
.init = alloutput_init, | ||
.rx = default_rx_hook, | ||
.init = cadillac_init, | ||
.rx = cadillac_rx_hook, | ||
.tx = alloutput_tx_hook, | ||
.tx_lin = alloutput_tx_lin_hook, | ||
.ignition = alloutput_ign_hook, | ||
.ignition = cadillac_ign_hook, | ||
.fwd = alloutput_fwd_hook, | ||
}; | ||
|