rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
board_configuration.cpp File Reference

Functions

static void setInjectorPins ()
 
static void setIgnitionPins ()
 
static void setupDefaultSensorInputs ()
 
static void hellen154hyundai_f7_boardConfigOverrides ()
 
static void hellen154hyundai_f7_boardDefaultConfiguration ()
 Board-specific configuration defaults.
 
static void hellen154hyundai_f7_boardInitHardware ()
 
int getBoardMetaOutputsCount ()
 
int getBoardMetaLowSideOutputsCount ()
 
int getBoardMetaDcOutputsCount ()
 
GpiogetBoardMetaOutputs ()
 
void setup_custom_board_overrides ()
 

Variables

static struct tle9201_config tle9201
 
static Gpio OUTPUTS []
 
static const struct mc33810_config mc33810
 

Function Documentation

◆ getBoardMetaDcOutputsCount()

int getBoardMetaDcOutputsCount ( )

Definition at line 227 of file board_configuration.cpp.

227 {
228 return 2;
229}

◆ getBoardMetaLowSideOutputsCount()

int getBoardMetaLowSideOutputsCount ( )

Definition at line 223 of file board_configuration.cpp.

223 {
225}
int getBoardMetaOutputsCount()
Here is the call graph for this function:

◆ getBoardMetaOutputs()

Gpio * getBoardMetaOutputs ( )

Definition at line 231 of file board_configuration.cpp.

231 {
232 return OUTPUTS;
233}
static Gpio OUTPUTS[]

◆ getBoardMetaOutputsCount()

int getBoardMetaOutputsCount ( )

Definition at line 219 of file board_configuration.cpp.

219 {
220 return efi::size(OUTPUTS);
221}

◆ hellen154hyundai_f7_boardConfigOverrides()

static void hellen154hyundai_f7_boardConfigOverrides ( )
static

Definition at line 69 of file board_configuration.cpp.

69 {
70 /* Force 3.3V PWR_EN as MC33810 is powered from this power line */
72
74
75 /* MC33810, ETB1 and WASTGATE1 */
77
78 // trigger inputs
79 engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_D_1;
80 // Direct hall-only cam input
81 engineConfiguration->camInputs[0] = Gpio::H144_IN_D_2; // intake
82 engineConfiguration->camInputs[1] = Gpio::H144_IN_D_3; // exhaust
83
84 // todo You would not believe how you invert TLE9201 #4579
86
87 setupTLE9201(/*controlPin*/Gpio::H144_OUT_PWM2, Gpio::H144_OUT_PWM3, Gpio::H144_OUT_IO12);
88
89 // wastegate DC motor
90 setupTLE9201(/*controlPin*/Gpio::H144_OUT_PWM4, Gpio::H144_OUT_PWM5, Gpio::H144_OUT_IO13, 1);
91}
void setupTLE9201(Gpio controlPin, Gpio direction, Gpio disable, int dcIndex)
static constexpr engine_configuration_s * engineConfiguration
void hellenMegaModule()
void setHellenMegaEnPin(bool enableBoardOnStartUp)
static void enableHellenSpi3()
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]

Referenced by setup_custom_board_overrides().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hellen154hyundai_f7_boardDefaultConfiguration()

static void hellen154hyundai_f7_boardDefaultConfiguration ( )
static

Board-specific configuration defaults.

See also setDefaultEngineConfiguration

Definition at line 100 of file board_configuration.cpp.

100 {
103
104 setHellenCan();
105
106 engineConfiguration->fuelPumpPin = Gpio::H144_OUT_IO9;
107 engineConfiguration->fanPin = Gpio::H144_OUT_IO7;
108 engineConfiguration->mainRelayPin = Gpio::H144_OUT_IO3; // pin: 111a
109 // BK1 uses wire, BK2 uses CANbus
110 engineConfiguration->malfunctionIndicatorPin = Gpio::H144_OUT_PWM8;
111
112 engineConfiguration->brakePedalPin = Gpio::H144_IN_RES3;
113 engineConfiguration->clutchUpPin = Gpio::H144_IN_RES2;
114 engineConfiguration->acSwitch = Gpio::H144_IN_RES1;
115
116#ifndef EFI_BOOTLOADER
117 setCommonNTCSensor(&engineConfiguration->oilTempSensor, HELLEN_DEFAULT_AT_PULLUP); // random calibration for now
118#endif
120
121 // "required" hardware is done - set some reasonable defaults
123
124 engineConfiguration->etbFunctions[1] = DC_Wastegate;
125}
static void setupDefaultSensorInputs()
static void setIgnitionPins()
static void setInjectorPins()
void setHellenCan()
void setCommonNTCSensor(ThermistorConf *thermistorConf, float pullup)

Referenced by setup_custom_board_overrides().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hellen154hyundai_f7_boardInitHardware()

static void hellen154hyundai_f7_boardInitHardware ( )
static

Definition at line 193 of file board_configuration.cpp.

193 {
194 static OutputPin spi3CsWastegate;
195
196 spi3CsWastegate.initPin("spi3-cs-wg", Gpio::H144_GP_IO6);
197 spi3CsWastegate.setValue(1);
198 // mc33810 takes care of the CS on it's own
199// static OutputPin spi3CsMc33810;
200// spi3CsMc33810.initPin("spi3-cs-mc33810", Gpio::H144_OUT_PWM1);
201// spi3CsMc33810.setValue(1);
202
203 gpio_pin_markUsed(tle9201.spi_config.ssport, tle9201.spi_config.sspad, "TLE9201 ETB CS");
204 palSetPadMode(tle9201.spi_config.ssport, tle9201.spi_config.sspad, PAL_MODE_OUTPUT_PUSHPULL);
205 int retTle = tle9201_add(0, &tle9201);
206 efiPrintf("*****************+ tle9201_add %d +*******************", retTle);
207
208 #if (BOARD_MC33810_COUNT > 0)
209 gpio_pin_markUsed(mc33810.spi_config.ssport, mc33810.spi_config.sspad, "mc33810 CS");
210 palSetPadMode(mc33810.spi_config.ssport, mc33810.spi_config.sspad, PAL_MODE_OUTPUT_PUSHPULL);
211
213 efiPrintf("*****************+ mc33810_add %d +*******************", ret);
214 #else
215 efiPrintf("**********------------- mc33810 not configured yet ------------************");
216 #endif
217}
Single output pin reference and state.
Definition efi_output.h:49
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError=false)
Definition efi_gpio.cpp:711
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition efi_gpio.cpp:604
@ MC33810_0_OUT_0
static struct tle9201_config tle9201
static const struct mc33810_config mc33810
int mc33810_add(brain_pin_e base, unsigned int index, const mc33810_config *cfg)
MC33810 driver add.
Definition mc33810.cpp:946
bool gpio_pin_markUsed(ioportid_t port, ioportmask_t pin, const char *msg)
SPIConfig spi_config
Definition mc33810.h:31
SPIConfig spi_config
Definition tle9201.h:33
int tle9201_add(unsigned int index, const tle9201_config *cfg)
TLE9201 driver add.
Definition tle9201.cpp:279

Referenced by setup_custom_board_overrides().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setIgnitionPins()

static void setIgnitionPins ( )
static

◆ setInjectorPins()

static void setInjectorPins ( )
static

◆ setup_custom_board_overrides()

void setup_custom_board_overrides ( )

Definition at line 235 of file board_configuration.cpp.

235 {
239}
std::optional< setup_custom_board_overrides_type > custom_board_InitHardware
Definition hardware.cpp:77
std::optional< setup_custom_board_overrides_type > custom_board_ConfigOverrides
std::optional< setup_custom_board_overrides_type > custom_board_DefaultConfiguration
static void hellen154hyundai_f7_boardInitHardware()
static void hellen154hyundai_f7_boardDefaultConfiguration()
Board-specific configuration defaults.
static void hellen154hyundai_f7_boardConfigOverrides()
Here is the call graph for this function:

◆ setupDefaultSensorInputs()

static void setupDefaultSensorInputs ( )
static

Definition at line 32 of file board_configuration.cpp.

32 {
33 engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
34 engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
35
37
38 setTPS1Inputs(H144_IN_TPS, H144_IN_TPS2);
39 setPPSInputs(H144_IN_PPS, H144_IN_PPS2);
40
42
43 engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
44
45 engineConfiguration->clt.adcChannel = H144_IN_CLT;
46
47 engineConfiguration->iat.adcChannel = H144_IN_IAT;
48}
void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2)
void setTPS1Inputs(adc_channel_e tps1, adc_channel_e tps2)
Here is the call graph for this function:

Variable Documentation

◆ mc33810

const struct mc33810_config mc33810
static

Definition at line 149 of file board_configuration.cpp.

149 {
150 .spi_bus = &SPID3,
151 .spi_config = {
152 .circular = false,
153#ifdef _CHIBIOS_RT_CONF_VER_6_1_
154 .end_cb = nullptr,
155#else
156 .slave = false,
157 .data_cb = nullptr,
158 .error_cb = nullptr,
159#endif
160 // SPI3_CS_33810 OUT_PWM1 H144_OUT_PWM1
161 .ssport = GPIOD,
162 .sspad = 13,
163 .cr1 =
164 SPI_CR1_16BIT_MODE |
165 SPI_CR1_SSM |
166 SPI_CR1_SSI |
167// ((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) | /* div = 16 */
168 ((0b110 << SPI_CR1_BR_Pos) & SPI_CR1_BR) | /* div = 128 */
169 SPI_CR1_MSTR |
170 0,
171 .cr2 = SPI_CR2_16BIT_MODE
172 },
173 .direct_io = {
174 /* injector drivers */
175 [0] = {.port = GPIOG, .pad = 7}, /* H144_LS_1 inj 1 */
176 [1] = {.port = GPIOG, .pad = 8}, /* H144_LS_2 inj 2 */
177 [2] = {.port = GPIOD, .pad = 11}, /* H144_LS_3 inj 3 */
178 [3] = {.port = GPIOD, .pad = 10}, /* H144_LS_4 inj 4 */
179 /* ignition pre-drivers */
180 [4] = {.port = GPIOG, .pad = 5}, /* H144_OUT_IO4 */
181 [5] = {.port = GPIOD, .pad = 2}, /* H144_OUT_IO5 */
182 [6] = {.port = GPIOG, .pad = 11}, /* H144_OUT_IO6 */
183 [7] = {.port = GPIOG, .pad = 2}, /* H144_OUT_IO11 */
184 },
185 .en = {.port = GPIOG, .pad = 9}, // H144_GP_IO4 hopefully
186 // TODO: pick from engineConfiguration->spi3sckPin or whatever SPI is used
187 .sck = {.port = GPIOC, .pad = 10},
188 .spkdur = Gpio::Unassigned,
189 .nomi = Gpio::Unassigned,
190 .maxi = Gpio::Unassigned
191};
@ Unassigned

Referenced by f407_discovery_boardInitHardware(), and hellen154hyundai_f7_boardInitHardware().

◆ OUTPUTS

Gpio OUTPUTS[]
static
Initial value:
= {
Gpio::H144_LS_5,
Gpio::H144_LS_6,
Gpio::H144_LS_7,
Gpio::H144_OUT_IO7,
Gpio::H144_OUT_IO3,
Gpio::H144_OUT_IO9,
Gpio::H144_OUT_IO10,
Gpio::H144_OUT_IO8,
Gpio::H144_OUT_PWM8,
}

Definition at line 127 of file board_configuration.cpp.

127 {
128 Gpio::MC33810_0_OUT_0, // 0: INJ_1 k25
129 Gpio::MC33810_0_OUT_1, // INJ_2 k26
130 Gpio::MC33810_0_OUT_2, // INJ_3 k27
131 Gpio::MC33810_0_OUT_3, // 3: INJ_4 k28
132 Gpio::H144_LS_5, // VVT1
133 Gpio::H144_LS_6, // 5: VVT2
134 Gpio::H144_LS_7, // K47 BK1 Wastegate Solenoid
135 Gpio::H144_OUT_IO7, // Fan Relay Low
136 Gpio::H144_OUT_IO3, // Main Relay K64
137 Gpio::H144_OUT_IO9, // Fuel Pump K70
138 Gpio::H144_OUT_IO10, // 10: K87 AC Relay
139 Gpio::H144_OUT_IO8, // Fan Relay HI
140 Gpio::MC33810_0_GD_0, // Coil 1
141 Gpio::MC33810_0_GD_1, // Coil 2
142 Gpio::MC33810_0_GD_2, // Coil 3
143 Gpio::MC33810_0_GD_3, // Coil 4
144 Gpio::H144_OUT_PWM8, // MIL
145// QC procedure seems to not work for that one Gpio::H144_OUT_PWM7, // low side? Tacho unused CAN tachometer right?
146// Gpio::H_SPI1_SCK, // X8 AuxLS1
147};

◆ tle9201

struct tle9201_config tle9201
static
Initial value:
= {
.spi_bus = &SPID3,
.spi_config = {
.circular = false,
#ifdef _CHIBIOS_RT_CONF_VER_6_1_
.end_cb = nullptr,
#else
.slave = false,
.data_cb = nullptr,
.error_cb = nullptr,
#endif
.ssport = GPIOA,
.sspad = 15,
.cr1 = TLE9201_CONFIG_CR1,
.cr2 = TLE9201_CONFIG_CR2
}
}

Definition at line 50 of file board_configuration.cpp.

50 {
51 .spi_bus = &SPID3,
52 .spi_config = {
53 .circular = false,
54#ifdef _CHIBIOS_RT_CONF_VER_6_1_
55 .end_cb = nullptr,
56#else
57 .slave = false,
58 .data_cb = nullptr,
59 .error_cb = nullptr,
60#endif
61 // H_SPI3_CS
62 .ssport = GPIOA,
63 .sspad = 15,
64 .cr1 = TLE9201_CONFIG_CR1,
65 .cr2 = TLE9201_CONFIG_CR2
66 }
67};

Referenced by hellen154hyundai_f7_boardInitHardware().

Go to the source code of this file.