rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
board_configuration.cpp
Go to the documentation of this file.
1/**
2 * @file boards/proteus/board_configuration.cpp
3 *
4 * @brief Configuration defaults for the Proteus board
5 *
6 * @author Matthew Kennedy, (c) 2019
7 */
8
9#include "pch.h"
10#include "proteus_meta.h"
11#include "board_overrides.h"
12
13static const brain_pin_e injPins[] = {
14 Gpio::PROTEUS_LS_1,
15 Gpio::PROTEUS_LS_2,
16 Gpio::PROTEUS_LS_3,
17 Gpio::PROTEUS_LS_4,
18 Gpio::PROTEUS_LS_5,
19 Gpio::PROTEUS_LS_6,
20 Gpio::PROTEUS_LS_7,
21 Gpio::PROTEUS_LS_8,
22 Gpio::PROTEUS_LS_9,
23 Gpio::PROTEUS_LS_10,
24 Gpio::PROTEUS_LS_11,
25 Gpio::PROTEUS_LS_12
26};
27
28static const brain_pin_e ignPins[] = {
29 Gpio::PROTEUS_IGN_1,
30 Gpio::PROTEUS_IGN_2,
31 Gpio::PROTEUS_IGN_3,
32 Gpio::PROTEUS_IGN_4,
33 Gpio::PROTEUS_IGN_5,
34 Gpio::PROTEUS_IGN_6,
35 Gpio::PROTEUS_IGN_7,
36 Gpio::PROTEUS_IGN_8,
37 Gpio::PROTEUS_IGN_9,
38 Gpio::PROTEUS_IGN_10,
39 Gpio::PROTEUS_IGN_11,
40 Gpio::PROTEUS_IGN_12,
41};
42
43static void setInjectorPins() {
45}
46
47static void setIgnitionPins() {
49}
50
51// PE3 is error LED, configured in board.mk
53 return Gpio::E4;
54}
55
57 return Gpio::E5;
58}
59
61 return Gpio::E6;
62}
63
64static void setupVbatt() {
65 // 5.6k high side/10k low side = 1.56 ratio divider
67
68 // 82k high side/10k low side = 9.2
69 engineConfiguration->vbattDividerCoeff = (92.0f / 10.0f);
70
71 // Battery sense on PA7
73
75}
76
77static void setupEtb() {
78 // TLE9201 driver
79 // This chip has three control pins:
80 // DIR - sets direction of the motor
81 // PWM - pwm control (enable high, coast low)
82 // DIS - disables motor (enable low)
83
84 // Throttle #1
85 // PWM pin
87 // DIR pin
89 // Disable pin
91
92 // Throttle #2
93 // PWM pin
95 // DIR pin
97 // Disable pin
99
100 // we only have pwm/dir, no dira/dirb
102}
103
105 // trigger inputs
106 // Digital channel 1 as default - others not set
107 engineConfiguration->triggerInputPins[0] = PROTEUS_DIGITAL_1;
109
111
112
113 engineConfiguration->clt.adcChannel = PROTEUS_IN_CLT;
114 engineConfiguration->iat.adcChannel = PROTEUS_IN_IAT;
115 engineConfiguration->tps1_1AdcChannel = PROTEUS_IN_TPS;
116 engineConfiguration->map.sensor.hwChannel = PROTEUS_IN_MAP;
117
118 // see also enableAemXSeries
119 // pin #28 WBO AFR "Analog Volt 10"
120 engineConfiguration->afr.hwChannel = PROTEUS_IN_ANALOG_VOLT_10;
121}
122
137
153
154/**
155 * @brief Board-specific configuration defaults.
156 *
157 * See also setDefaultEngineConfiguration
158 *
159
160 */
164 setupEtb();
165
167
168 // "required" hardware is done - set some reasonable defaults
170
172
173#if HW_PROTEUS & EFI_PROD_CODE
174 engineConfiguration->mainRelayPin = Gpio::PROTEUS_LS_12;
175 engineConfiguration->fanPin = Gpio::PROTEUS_LS_11;
176 engineConfiguration->fuelPumpPin = Gpio::PROTEUS_LS_10;
177#endif // HW_PROTEUS
178
179 // If we're running as hardware CI, borrow a few extra pins for that
180#ifdef HARDWARE_CI
183#endif
184}
185
187 // Wake on the CAN RX pin
188 palEnableLineEvent(PAL_LINE(GPIOD, 0), PAL_EVENT_MODE_RISING_EDGE);
189}
190
191#if HW_PROTEUS
193 Gpio::PROTEUS_LS_1, // inj 1
194 Gpio::PROTEUS_LS_2, // inj 2
195 Gpio::PROTEUS_LS_3, // inj 3
196 Gpio::PROTEUS_LS_4, // inj 4
197};
198
200 Gpio::PROTEUS_LS_14, // inj 1 four times
201 Gpio::PROTEUS_LS_14, // inj 1 four times
202 Gpio::PROTEUS_LS_14, // inj 1 four times
203 Gpio::PROTEUS_LS_14, // inj 1 four times
204
205 Gpio::PROTEUS_LS_15, // inj 4 four times
206 Gpio::PROTEUS_LS_15, // inj 4 four times
207 Gpio::PROTEUS_LS_15, // inj 4 four times
208 Gpio::PROTEUS_LS_15, // inj 4 four times
209
210};
211
213 Gpio::PROTEUS_LS_1, // inj 1
214 Gpio::PROTEUS_LS_2, // inj 2
215 Gpio::PROTEUS_LS_3,
216 Gpio::PROTEUS_LS_4,
217 Gpio::PROTEUS_LS_5,
218 Gpio::PROTEUS_LS_6,
219 Gpio::PROTEUS_LS_7,
220 Gpio::PROTEUS_LS_8,
221 Gpio::PROTEUS_LS_9, // inj 9
222 Gpio::PROTEUS_LS_10, // inj 10
223 Gpio::PROTEUS_LS_11, // inj 11
224 Gpio::PROTEUS_LS_12, // inj 12
225 Gpio::PROTEUS_LS_14, // starter control or aux output
226 Gpio::PROTEUS_LS_15, // radiator fan relay output white
227
228
229 //Gpio::PROTEUS_LS_13, // main relay
230 //Gpio::PROTEUS_LS_16, // main relay
231};
232
234 Gpio::PROTEUS_LS_1, // inj 1
235 Gpio::PROTEUS_LS_2, // inj 2
236 Gpio::PROTEUS_LS_3, // inj 3
237 Gpio::PROTEUS_LS_4, // inj 4
238 Gpio::PROTEUS_LS_12, // main relay
239 Gpio::PROTEUS_LS_14, // starter
240};
241
243 Gpio::PROTEUS_LS_1, // inj 1
244 Gpio::PROTEUS_LS_2, // inj 2
245 Gpio::PROTEUS_LS_3, // inj 3
246 Gpio::PROTEUS_LS_12, // main relay
247 Gpio::PROTEUS_LS_14, // starter
248 Gpio::PROTEUS_LS_15, // intercooler fan
249 Gpio::PROTEUS_LS_4, // accessories relay
250 Gpio::PROTEUS_IGN_1,
251 Gpio::PROTEUS_IGN_2,
252 Gpio::PROTEUS_IGN_3,
253};
254
256 Gpio::PROTEUS_LS_1,
257 Gpio::PROTEUS_LS_2,
258 Gpio::PROTEUS_IGN_1,
259 Gpio::PROTEUS_IGN_2,
260 Gpio::PROTEUS_IGN_8, // ACR
261 Gpio::PROTEUS_IGN_9, // ACR2
262};
263
282
284Gpio::PROTEUS_LS_1,
285Gpio::PROTEUS_LS_2,
286Gpio::PROTEUS_LS_3,
287Gpio::PROTEUS_LS_4,
288Gpio::PROTEUS_LS_5,
289Gpio::PROTEUS_LS_6,
290Gpio::PROTEUS_LS_7,
291Gpio::PROTEUS_LS_8,
292Gpio::PROTEUS_LS_9,
293Gpio::PROTEUS_LS_10,
294Gpio::PROTEUS_LS_11,
295Gpio::PROTEUS_LS_12,
296Gpio::PROTEUS_LS_13,
297Gpio::PROTEUS_LS_14,
298Gpio::PROTEUS_LS_15,
299Gpio::PROTEUS_LS_16,
300 Gpio::PROTEUS_IGN_1,
301 Gpio::PROTEUS_IGN_2,
302 Gpio::PROTEUS_IGN_3,
303 Gpio::PROTEUS_IGN_4,
304 Gpio::PROTEUS_IGN_5,
305 Gpio::PROTEUS_IGN_6,
306 Gpio::PROTEUS_IGN_7,
307 Gpio::PROTEUS_IGN_8,
308 Gpio::PROTEUS_IGN_9,
309 Gpio::PROTEUS_IGN_10,
310 Gpio::PROTEUS_IGN_11,
311 Gpio::PROTEUS_IGN_12,
312 Gpio::PROTEUS_HS_1,
313 Gpio::PROTEUS_HS_2,
314 Gpio::PROTEUS_HS_3,
315 Gpio::PROTEUS_HS_4
316};
317
339
342 return 2;
343 }
348 ) {
349 return 1;
350 }
351 return 1;
352/* return 2; proteus has two h-b ridges but stim board is short on channels to test :( */
353}
354
376#endif // HW_PROTEUS
377
Gpio getWarningLedPin()
Gpio getCommsLedPin()
Gpio getRunningLedPin()
void setup_custom_board_overrides()
@ Unassigned
std::optional< setup_custom_board_overrides_type > custom_board_ConfigOverrides
std::optional< setup_custom_board_overrides_type > custom_board_DefaultConfiguration
static constexpr engine_configuration_s * engineConfiguration
static void setupDefaultSensorInputs()
static void setIgnitionPins()
void boardPrepareForStop()
int getBoardMetaOutputsCount()
Gpio * getBoardMetaOutputs()
static void setInjectorPins()
int getBoardMetaLowSideOutputsCount()
int getBoardMetaDcOutputsCount()
static void setupEtb()
static void setupVbatt()
static Gpio PROTEUS_M73_OUTPUTS[]
static Gpio PROTEUS_SUBARU_OUTPUTS[]
static const brain_pin_e ignPins[]
static Gpio PROTEUS_CANAM_OUTPUTS[]
static void proteus_boardConfigOverrides()
static void setupSdCard()
static Gpio PROTEUS_HARLEY_OUTPUTS[]
static void proteus_boardDefaultConfiguration()
Board-specific configuration defaults.
static Gpio PROTEUS_OUTPUTS[]
static Gpio PROTEUS_SBC_OUTPUTS[]
static const brain_pin_e injPins[]
static Gpio PROTEUS_SLINGSHOT_OUTPUTS[]
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]