Skip to content

Commit d176220

Browse files
committed
Ignition: made a default hook for GPIO
1 parent bea5187 commit d176220

6 files changed

+13
-32
lines changed

board/safety/safety_defaults.h

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
void default_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {}
22

3+
int default_ign_hook() {
4+
return -1; // use GPIO to determine ignition
5+
}
6+
37
// *** no output safety mode ***
48

59
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) {
1418
return false;
1519
}
1620

17-
static int nooutput_ign_hook() {
18-
return -1;
19-
}
2021
static int nooutput_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
2122
return -1;
2223
}
@@ -26,7 +27,7 @@ const safety_hooks nooutput_hooks = {
2627
.rx = default_rx_hook,
2728
.tx = nooutput_tx_hook,
2829
.tx_lin = nooutput_tx_lin_hook,
29-
.ignition = nooutput_ign_hook,
30+
.ignition = default_ign_hook,
3031
.fwd = nooutput_fwd_hook,
3132
};
3233

@@ -44,10 +45,6 @@ static int alloutput_tx_lin_hook(int lin_num, uint8_t *data, int len) {
4445
return true;
4546
}
4647

47-
static int alloutput_ign_hook() {
48-
return -1;
49-
}
50-
5148
static int alloutput_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
5249
return -1;
5350
}
@@ -57,7 +54,7 @@ const safety_hooks alloutput_hooks = {
5754
.rx = default_rx_hook,
5855
.tx = alloutput_tx_hook,
5956
.tx_lin = alloutput_tx_lin_hook,
60-
.ignition = alloutput_ign_hook,
57+
.ignition = default_ign_hook,
6158
.fwd = alloutput_fwd_hook,
6259
};
6360

board/safety/safety_elm327.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ static void elm327_init(int16_t param) {
3131
controls_allowed = 1;
3232
}
3333

34-
static int elm327_ign_hook() {
35-
return -1;
36-
}
37-
3834
static int elm327_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
3935
return -1;
4036
}
@@ -44,6 +40,6 @@ const safety_hooks elm327_hooks = {
4440
.rx = elm327_rx_hook,
4541
.tx = elm327_tx_hook,
4642
.tx_lin = elm327_tx_lin_hook,
47-
.ignition = elm327_ign_hook,
43+
.ignition = default_ign_hook,
4844
.fwd = elm327_fwd_hook,
4945
};

board/safety/safety_ford.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,11 @@ static int ford_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
9696
return -1;
9797
}
9898

99-
static int ford_ign_hook() {
100-
return -1;
101-
}
102-
10399
const safety_hooks ford_hooks = {
104100
.init = ford_init,
105101
.rx = ford_rx_hook,
106102
.tx = ford_tx_hook,
107103
.tx_lin = ford_tx_lin_hook,
108-
.ignition = ford_ign_hook,
104+
.ignition = default_ign_hook,
109105
.fwd = ford_fwd_hook,
110106
};

board/safety/safety_honda.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,12 @@ static int honda_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
134134
return -1;
135135
}
136136

137-
static int honda_ign_hook() {
138-
return -1;
139-
}
140-
141137
const safety_hooks honda_hooks = {
142138
.init = honda_init,
143139
.rx = honda_rx_hook,
144140
.tx = honda_tx_hook,
145141
.tx_lin = honda_tx_lin_hook,
146-
.ignition = honda_ign_hook,
142+
.ignition = default_ign_hook,
147143
.fwd = honda_fwd_hook,
148144
};
149145

@@ -165,6 +161,6 @@ const safety_hooks honda_bosch_hooks = {
165161
.rx = honda_rx_hook,
166162
.tx = honda_tx_hook,
167163
.tx_lin = honda_tx_lin_hook,
168-
.ignition = honda_ign_hook,
164+
.ignition = default_ign_hook,
169165
.fwd = honda_bosch_fwd_hook,
170166
};

board/safety/safety_toyota.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ static void toyota_init(int16_t param) {
175175
dbc_eps_torque_factor = param;
176176
}
177177

178-
static int toyota_ign_hook() {
179-
return -1;
180-
}
181-
182178
static int toyota_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
183179
return -1;
184180
}
@@ -188,7 +184,7 @@ const safety_hooks toyota_hooks = {
188184
.rx = toyota_rx_hook,
189185
.tx = toyota_tx_hook,
190186
.tx_lin = toyota_tx_lin_hook,
191-
.ignition = toyota_ign_hook,
187+
.ignition = default_ign_hook,
192188
.fwd = toyota_fwd_hook,
193189
};
194190

@@ -203,6 +199,6 @@ const safety_hooks toyota_nolimits_hooks = {
203199
.rx = toyota_rx_hook,
204200
.tx = toyota_tx_hook,
205201
.tx_lin = toyota_tx_lin_hook,
206-
.ignition = toyota_ign_hook,
202+
.ignition = default_ign_hook,
207203
.fwd = toyota_fwd_hook,
208204
};

board/safety/safety_toyota_ipas.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ const safety_hooks toyota_ipas_hooks = {
180180
.rx = toyota_ipas_rx_hook,
181181
.tx = toyota_ipas_tx_hook,
182182
.tx_lin = toyota_tx_lin_hook,
183-
.ignition = toyota_ign_hook,
183+
.ignition = default_ign_hook,
184184
.fwd = toyota_fwd_hook,
185185
};
186186

0 commit comments

Comments
 (0)