openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
954 B

void subaru_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {}
// FIXME
// *** all output safety mode ***
static void subaru_init(int16_t param) {
controls_allowed = 1;
}
static int subaru_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
return true;
}
static int subaru_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
// shifts bits 29 > 11
int32_t addr = to_fwd->RIR >> 21;
// forward CAN 0 > 1
if (bus_num == 0) {
return 1; // ES CAN
}
// forward CAN 1 > 0, except ES_LKAS
else if (bus_num == 1) {
// outback 2015
if (addr == 0x164) {
return -1;
}
// global platform
if (addr == 0x122) {
return -1;
}
return 0; // Main CAN
}
// fallback to do not forward
return -1;
}
const safety_hooks subaru_hooks = {
.init = subaru_init,
.rx = subaru_rx_hook,
.tx = subaru_tx_hook,
.tx_lin = nooutput_tx_lin_hook,
.ignition = default_ign_hook,
.fwd = subaru_fwd_hook,
};