rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
board_configuration.cpp
Go to the documentation of this file.
1
2#include "pch.h"
3#include "defaults.h"
4#include "smart_gpio.h"
6
7// PB14 is error LED, configured in board.mk
9 // this board has LEDs
10 return Gpio::Unassigned;
11}
12
14 // this board has LEDs
15 return Gpio::Unassigned;
16}
17
19 // this board has LEDs
20 return Gpio::Unassigned;
21}
22
31
32static void setIgnitionPins() {
35 /* Two following has no IGBT populated, wasted spark is used */
38
40}
41
42static void setupEtb() {
43 // TLE9201 driver
44 // This chip has three control pins:
45 // DIR - sets direction of the motor
46 // PWM - pwm control (enable high, coast low)
47 // DIS - disables motor (enable low)
48
49 // PWM pin
51 // DIR pin
53// // Disable pin todo clarify if we have it?
54// engineConfiguration->etbIo[0].disablePin = Gpio::C8;
55
56 // we only have pwm/dir, no dira/dirb
58}
59
60/**
61 * @brief Board-specific configuration defaults.
62
63 */
67
69 engineConfiguration->firingOrder = FO_1_3_4_2;
70
71 engineConfiguration->ignitionMode = IM_WASTED_SPARK;
73 engineConfiguration->injectionMode = IM_SEQUENTIAL;
74
75 /* SPI1 is used for communication with L9779 */
77
81
84
85// todo engineConfiguration->clt.adcChannel = EFI_ADC_; // ADC3 PF5
86// todo engineConfiguration->iat.adcChannel = EFI_ADC_; // ADC3 PF6
87// todo engineConfiguration->map.sensor.hwChannel = EFI_ADC_;
88
89 // ?k high side/?k low side = ? ratio divider todo is the value below right?
91
92// todo engineConfiguration->vbattDividerCoeff = (33 + 6.8) / 6.8; // 5.835
93
94// engineConfiguration->vbattAdcChannel = EFI_ADC_;
96
97 setTPS1Inputs(EFI_ADC_12, EFI_ADC_13);
98
99 setPPSInputs(EFI_ADC_10, EFI_ADC_11);
100}
101
103 //CAN 1 bus overwrites
106 setupEtb();
107}
108
109static struct l9779_config l9779_cfg = {
110 .spi_bus = &SPID1,
111 .spi_config = {
112 .circular = false,
113#ifdef _CHIBIOS_RT_CONF_VER_6_1_
114 .end_cb = nullptr,
115#else
116 .slave = false,
117 .data_cb = nullptr,
118 .error_cb = nullptr,
119#endif
120 .ssport = GPIOE,
121 .sspad = 12,
122 .cr1 =
123 SPI_CR1_16BIT_MODE |
124 SPI_CR1_SSM |
125 SPI_CR1_SSI |
126 SPI_CR1_LSBFIRST | //LSB first
127 ((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) | // div = 16
128 SPI_CR1_MSTR |
129 SPI_CR1_CPHA |
130 0,
131 .cr2 = SPI_CR2_16BIT_MODE
132 },
133 .direct_gpio = {
134 /* ignition pre-drivers */
135 [0] = {.port = GPIOF, .pad = 12},
136 [1] = {.port = GPIOF, .pad = 13},
137 [2] = {.port = GPIOF, .pad = 14},
138 [3] = {.port = GPIOF, .pad = 15},
139 /* IN1 .. IN7 */
140 [4] = {.port = GPIOE, .pad = 8},
141 [5] = {.port = GPIOE, .pad = 9},
142 [6] = {.port = GPIOE, .pad = 10},
143 [7] = {.port = GPIOE, .pad = 11},
144 [8] = {.port = GPIOG, .pad = 5},
145 [9] = {.port = GPIOG, .pad = 6},
146 [10] = {.port = GPIOG, .pad = 7},
147 },
148 /* PWM signal */
149 .pwm_gpio = {.port = NULL, .pad = 0}
150};
151
153{
154 int ret;
155
157 if (ret < 0) {
158 /* error */
159 }
160}
161
162/**
163 * @brief Board-specific initialization code.
164 */
165void boardInit() {
167}
168
169static Gpio OUTPUTS[] = {
170 Gpio::L9779_OUT_4, // Injector 1
171 Gpio::L9779_OUT_3, // Injector 2
172// Gpio::L9779_OUT_2, // Injector 3
173// Gpio::L9779_OUT_1, // Injector 4
174// Gpio::L9779_OUT_6, // Oxygen sensor 1 heater
175// Gpio::L9779_OUT_5, // EVAP solenoid control
176// Gpio::L9779_OUT_7, // Oxygen sensor 2 heater
177// Gpio::L9779_IGN_1, // Coil 1 (< +2.5v) / Coils 1,4
178// Gpio::L9779_IGN_3, // Coil 3 (< +2.5v) / Coils 2,4
179// Gpio::L9779_OUT_17, // Air compressor control
180// Gpio::L9779_OUT_14, // Secondary starter relay
181// Gpio::L9779_OUT_15, // FAN 1 relay
182// Gpio::L9779_OUT_16, // FAN 2 relay
183// Gpio::L9779_OUT_13, // Fuel pump relay
184};
185
187 return efi::size(OUTPUTS);
188}
189
191 return 1;
192}
197
Gpio getWarningLedPin()
Gpio getCommsLedPin()
Gpio getRunningLedPin()
void setup_custom_board_overrides()
@ L9779_IGN_2
@ L9779_OUT_3
@ Unassigned
@ L9779_IGN_1
@ L9779_IGN_3
@ L9779_OUT_1
@ L9779_IGN_4
@ L9779_OUT_2
@ L9779_OUT_4
void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2)
void setTPS1Inputs(adc_channel_e tps1, adc_channel_e tps2)
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
void boardInit()
Board-specific initialization code.
SPIDriver SPID1
SPI0 driver identifier.
Definition hal_spi_lld.c:42
static Gpio OUTPUTS[]
static void setIgnitionPins()
int getBoardMetaOutputsCount()
static void setInjectorPins()
int getBoardMetaDcOutputsCount()
static void board_init_ext_gpios()
int l9779_add(brain_pin_e base, unsigned int index, const l9779_config *cfg)
L9779 driver add.
Definition l9779.cpp:733
static void m74_9_boardConfigOverrides()
static void setupEtb()
static struct l9779_config l9779_cfg
static void m74_9_boardDefaultConfiguration()
Board-specific configuration defaults.
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
SPIDriver * spi_bus
Definition l9779.h:26