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 alphax_8chan_boardInitHardware ()
 
void boardOnConfigurationChange (engine_configuration_s *)
 
static void alphax_8chan_boardConfigOverrides ()
 
static void alphax_8chan_defaultConfiguration ()
 Board-specific configuration defaults.
 
void boardPrepareForStop ()
 
int getBoardMetaOutputsCount ()
 
int getBoardMetaLowSideOutputsCount ()
 
GpiogetBoardMetaOutputs ()
 
int getBoardMetaDcOutputsCount ()
 
void setup_custom_board_overrides ()
 
int boardGetAnalogInputDiagnostic (adc_channel_e hwChannel, float voltage)
 

Variables

static OutputPin alphaCrankPPullUp
 
static OutputPin alphaHall1PullDown
 
static OutputPin alphaHall2PullDown
 
static OutputPin alphaHall3PullDown
 
static OutputPin alphaHall4PullDown
 
static OutputPin alphaHall5PullDown
 
static OutputPin alphaFlexPullDown
 
static OutputPin tempPullUp
 
static Gpio OUTPUTS_GM_GEN4 []
 
static Gpio OUTPUTS []
 

Function Documentation

◆ alphax_8chan_boardConfigOverrides()

static void alphax_8chan_boardConfigOverrides ( )
static

Definition at line 101 of file board_configuration.cpp.

101 {
103 setHellenCan();
105}
void setHellenCan()
void hellenMegaModule()
void setHellenCan2()

Referenced by setup_custom_board_overrides().

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

◆ alphax_8chan_boardInitHardware()

static void alphax_8chan_boardInitHardware ( )
static

Definition at line 76 of file board_configuration.cpp.

76 {
77 // technically same thing as setHellenMegaEnPin() since underlying pin E10 is same as H144_GP8
78 setHellenEnPin(Gpio::MM176_EN_PIN);
79
80 alphaCrankPPullUp.initPin("Crank-PullUp", Gpio::MM176_GP16);
81 alphaHall1PullDown.initPin("PullDown-Hall1", Gpio::MM176_OUT_IO10);
82 alphaHall2PullDown.initPin("PullDown-Hall2", Gpio::MM176_GP21);
83 alphaHall3PullDown.initPin("PullDown-Hall3", Gpio::MM176_GP22);
84 alphaHall4PullDown.initPin("PullDown-Hall4", Gpio::MM176_GP23);
85 alphaHall5PullDown.initPin("PullDown-Hall5", Gpio::MM176_GP24);
86 alphaFlexPullDown.initPin("PullDown-Flex", Gpio::MM176_GP25);
87 tempPullUp.initPin("Temp PullUp", Gpio::MM176_OUT_IO12);
88}
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError=false)
Definition efi_gpio.cpp:711
static OutputPin alphaCrankPPullUp
static OutputPin tempPullUp
static OutputPin alphaHall2PullDown
static OutputPin alphaHall5PullDown
static OutputPin alphaHall3PullDown
static OutputPin alphaFlexPullDown
static OutputPin alphaHall1PullDown
static OutputPin alphaHall4PullDown
void setHellenEnPin(Gpio pin, bool enableBoardOnStartUp)

Referenced by setup_custom_board_overrides().

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

◆ alphax_8chan_defaultConfiguration()

static void alphax_8chan_defaultConfiguration ( )
static

Board-specific configuration defaults.

See also setDefaultEngineConfiguration

Definition at line 113 of file board_configuration.cpp.

113 {
116 setupTLE9201(/*controlPin*/Gpio::MM176_OUT_PWM9, Gpio::MM176_GP6, Gpio::MM176_GP7);
117 setupTLE9201(/*controlPin*/Gpio::MM176_OUT_PWM18, Gpio::MM176_GP10, Gpio::MM176_GP11, 1);
118// engineConfiguration->vvtPins[0] = Gpio::H144_OUT_PWM7;
119// engineConfiguration->vvtPins[1] = Gpio::H144_OUT_PWM8;
120
122
124
125 engineConfiguration->mainRelayPin = Gpio::MM176_GP1;
126// engineConfiguration->fanPin = Gpio::H144_OUT_IO11;
127// engineConfiguration->fuelPumpPin = Gpio::H144_OUT_IO12;
128// engineConfiguration->tachOutputPin = Gpio::H144_OUT_IO13;
129
130 // "required" hardware is done - set some reasonable defaults
133
135 engineConfiguration->firingOrder = FO_1_3_4_2;
136
137 engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; // IM_WASTED_SPARK
138
139 engineConfiguration->launchActivationMode = CLUTCH_INPUT_LAUNCH;
140
141 engineConfiguration->vrThreshold[0].pin = Gpio::MM176_OUT_PWM11;
142 engineConfiguration->vrThreshold[1].pin = Gpio::MM176_OUT_PWM12;
143 //engineConfiguration->vrThreshold[2].pin = Gpio::MM176_OUT_PWM13;
144
145 hellenWbo();
146}
void setupTLE9201(Gpio controlPin, Gpio direction, Gpio disable, int dcIndex)
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
static void setupDefaultSensorInputs()
static void setIgnitionPins()
static void setInjectorPins()
void hellenWbo()
void setHellenMMbaro()

Referenced by setup_custom_board_overrides().

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

◆ boardGetAnalogInputDiagnostic()

int boardGetAnalogInputDiagnostic ( adc_channel_e  hwChannel,
float  voltage 
)

Definition at line 262 of file board_configuration.cpp.

262 {
263 /* we do not check voltage for valid ragne yet */
264 (void)voltage;
265
266 switch (hwChannel) {
267 /* inputs that may be affected by incorrect reference voltage */
268 case MM176_IN_TPS_ANALOG:
269 case MM176_IN_TPS2_ANALOG:
270 case MM176_IN_PPS1_ANALOG:
271 case MM176_IN_PPS2_ANALOG:
272 case MM176_IN_IAT_ANALOG:
273 case MM176_IN_AT1_ANALOG:
274 case MM176_IN_CLT_ANALOG:
275 case MM176_IN_AT2_ANALOG:
276 //case MM176_IN_O2S_ANALOG:
277 //case MM176_IN_O2S2_ANALOG:
278 case MM176_IN_MAP1_ANALOG:
279 case MM176_IN_MAP2_ANALOG:
280 case MM176_IN_AUX1_ANALOG:
281 case MM176_IN_AUX2_ANALOG:
282 case MM176_IN_AUX3_ANALOG:
283 case MM176_IN_AUX4_ANALOG:
284 /* TODO: more? */
285 return (boardGetAnalogDiagnostic() == ObdCode::None) ? 0 : -1;
286 /* all other inputs should not rely on output 5V */
287 default:
288 return 0;
289 }
290
291 return 0;
292}
ObdCode boardGetAnalogDiagnostic()
Here is the call graph for this function:

◆ boardOnConfigurationChange()

void boardOnConfigurationChange ( engine_configuration_s previousConfiguration)

Definition at line 90 of file board_configuration.cpp.

90 {
99}
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition efi_gpio.cpp:604
Here is the call graph for this function:

◆ boardPrepareForStop()

void boardPrepareForStop ( )

Definition at line 148 of file board_configuration.cpp.

148 {
149 // Wake on the CAN RX pin
150 palEnableLineEvent(PAL_LINE(GPIOD, 0), PAL_EVENT_MODE_RISING_EDGE);
151}

◆ getBoardMetaDcOutputsCount()

int getBoardMetaDcOutputsCount ( )

Definition at line 248 of file board_configuration.cpp.

248 {
250 // STATIC_BOARD_ID_PLATINUM_GM_GEN4
251 return 1;
252 }
253 return 2;
254}

◆ getBoardMetaLowSideOutputsCount()

int getBoardMetaLowSideOutputsCount ( )

Definition at line 234 of file board_configuration.cpp.

234 {
237 }
238 return getBoardMetaOutputsCount() - 6;
239}
int getBoardMetaOutputsCount()
Here is the call graph for this function:

◆ getBoardMetaOutputs()

Gpio * getBoardMetaOutputs ( )

Definition at line 241 of file board_configuration.cpp.

241 {
243 return OUTPUTS_GM_GEN4;
244 }
245 return OUTPUTS;
246}
static Gpio OUTPUTS[]
static Gpio OUTPUTS_GM_GEN4[]

◆ getBoardMetaOutputsCount()

int getBoardMetaOutputsCount ( )

Definition at line 227 of file board_configuration.cpp.

227 {
229 return efi::size(OUTPUTS_GM_GEN4);
230 }
231 return efi::size(OUTPUTS);
232}

◆ setIgnitionPins()

static void setIgnitionPins ( )
static

Definition at line 38 of file board_configuration.cpp.

38 {
39 engineConfiguration->ignitionPins[0] = Gpio::MM176_IGN1;
40 engineConfiguration->ignitionPins[1] = Gpio::MM176_IGN2;
41 engineConfiguration->ignitionPins[2] = Gpio::MM176_IGN3;
42 engineConfiguration->ignitionPins[3] = Gpio::MM176_IGN4;
43}

◆ setInjectorPins()

static void setInjectorPins ( )
static

◆ setup_custom_board_overrides()

void setup_custom_board_overrides ( )

Definition at line 256 of file board_configuration.cpp.

256 {
260}
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 alphax_8chan_defaultConfiguration()
Board-specific configuration defaults.
static void alphax_8chan_boardInitHardware()
static void alphax_8chan_boardConfigOverrides()
Here is the call graph for this function:

◆ setupDefaultSensorInputs()

static void setupDefaultSensorInputs ( )
static

Definition at line 45 of file board_configuration.cpp.

45 {
46 // trigger inputs, VR/hall crank
47 engineConfiguration->triggerInputPins[0] = Gpio::MM176_USB1ID; // 1B
48// engineConfiguration->triggerInputPins[1] = Gpio::H144_IN_CAM;
49 engineConfiguration->camInputs[0] = Gpio::MM176_IN_D1; // 15A
50 engineConfiguration->camInputs[1] = Gpio::MM176_IN_D2;
51 engineConfiguration->camInputs[2] = Gpio::MM176_IN_D3; // 24A
52 engineConfiguration->camInputs[3] = Gpio::MM176_IN_D4; // 9A
53 engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
54 engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
55
56 setTPS1Inputs(MM176_IN_TPS_ANALOG, MM176_IN_TPS2_ANALOG);
57
58 setPPSInputs(MM176_IN_PPS1_ANALOG, MM176_IN_PPS2_ANALOG);
59
60 // random values to have valid config
63
64
65// engineConfiguration->map.sensor.hwChannel = H144_IN_MAP2;
66 engineConfiguration->baroSensor.type = MT_MPXH6400;
67// engineConfiguration->baroSensor.hwChannel = H144_IN_MAP3;
68
69 engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
70
71 engineConfiguration->clt.adcChannel = MM176_IN_CLT_ANALOG;
72
73 engineConfiguration->iat.adcChannel = MM176_IN_IAT_ANALOG;
74}
void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2)
void setTPS1Inputs(adc_channel_e tps1, adc_channel_e tps2)
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
Here is the call graph for this function:

Variable Documentation

◆ alphaCrankPPullUp

OutputPin alphaCrankPPullUp
static

Definition at line 16 of file board_configuration.cpp.

◆ alphaFlexPullDown

OutputPin alphaFlexPullDown
static

◆ alphaHall1PullDown

OutputPin alphaHall1PullDown
static

◆ alphaHall2PullDown

OutputPin alphaHall2PullDown
static

◆ alphaHall3PullDown

OutputPin alphaHall3PullDown
static

◆ alphaHall4PullDown

OutputPin alphaHall4PullDown
static

◆ alphaHall5PullDown

OutputPin alphaHall5PullDown
static

◆ OUTPUTS

Gpio OUTPUTS[]
static

Definition at line 169 of file board_configuration.cpp.

169 {
170 Gpio::MM176_INJ1, // 1D - Injector 1
171 Gpio::MM176_INJ2, // 2D - Injector 2
172 Gpio::MM176_INJ3, // 3D - Injector 3
173 Gpio::MM176_INJ4, // 4D - Injector 4
174 Gpio::MM176_INJ5, // 5D - Injector 5
175
176 Gpio::MM176_INJ6, // 6D - Injector 6
177 Gpio::MM176_INJ7, // 7D - Injector 7
178 Gpio::MM176_OUT_PWM1, // 8D - VVT 1
179 Gpio::MM176_GP3, // 9D - Fuel Pump
180 Gpio::MM176_GP2, // 10D - Fan
181
182 Gpio::MM176_GP1, // 11D - Main Relay
183 Gpio::MM176_OUT_IO8, // 12D - NOS
184 Gpio::MM176_INJ8, // 13D - Injector 8
185 Gpio::MM176_OUT_PWM2, // 14D - VVT 2
186 Gpio::MM176_OUT_IO13, // 15D - Tachometer
187
188 Gpio::MM176_OUT_PWM6, // 16C - Low Side 1
189 Gpio::MM176_GP17, // 19D - Injector 9
190 Gpio::MM176_OUT_PWM3, // 20D - VVT 3
191 Gpio::MM176_OUT_PWM4, // 21D - VVT 4
192 Gpio::MM176_OUT_PWM5, // 22C - Boost
193
194 Gpio::MM176_OUT_PWM7, // 23C - Low Side 2
195 Gpio::MM176_GP20, // 24D - Injector 12
196 Gpio::MM176_GP19, // 25D - Injector 11
197 Gpio::MM176_GP18, // 26D - Injector 10
198 Gpio::MM176_OUT_IO3, // 8C - Low Side 3
199
200 Gpio::MM176_OUT_IO4, // 9C - Low Side 4
201 Gpio::MM176_OUT_IO5, // 17C - Low Side 5
202 Gpio::MM176_OUT_IO6, // 25C - Low Side 6
203 Gpio::MM176_OUT_IO7, // 34C - Low Side 7
204 Gpio::MM176_OUT_PWM8, // 5C - High Side 1
205
206 Gpio::MM176_OUT_IO2, // 6C - High Side 2
207 Gpio::MM176_OUT_IO1, // 7C - High Side 3
208 Gpio::MM176_IGN1, // 11C - Ignition 1
209 Gpio::MM176_IGN3, // 13C - Ignition 3
210 Gpio::MM176_IGN5, // 14C - Ignition 5
211
212// Gpio::MM176_IGN8, // 15C - Ignition 8
213//
214// Gpio::MM176_IGN2, // 19C - Ignition 2
215// Gpio::MM176_IGN4, // 20C - Ignition 4
216// Gpio::MM176_IGN7, // 21C - Ignition 7
217// Gpio::MM176_SPI3_MISO, // 23C - Ignition 10
218//
219// Gpio::MM176_IGN6, // 28C - Ignition 6
220// Gpio::MM176_SPI3_SCK, // 29C - Ignition 9
221// Gpio::MM176_SPI3_MOSI, // 30C - Ignition 11
222// Gpio::MM176_SPI3_CS, // 31C - Ignition 12
223
224
225};

◆ OUTPUTS_GM_GEN4

Gpio OUTPUTS_GM_GEN4[]
static
Initial value:
= {
Gpio::MM176_INJ1,
Gpio::MM176_INJ2,
Gpio::MM176_INJ3,
Gpio::MM176_INJ4,
Gpio::MM176_INJ5,
Gpio::MM176_INJ6,
Gpio::MM176_INJ7,
Gpio::MM176_INJ8,
Gpio::MM176_GP1,
Gpio::MM176_GP2,
}

Definition at line 153 of file board_configuration.cpp.

153 {
154 Gpio::MM176_INJ1, // 1D - Injector 1
155 Gpio::MM176_INJ2, // 2D - Injector 2
156 Gpio::MM176_INJ3, // 3D - Injector 3
157 Gpio::MM176_INJ4, // 4D - Injector 4
158
159 Gpio::MM176_INJ5, // 5D - Injector 5
160 Gpio::MM176_INJ6, // 6D - Injector 6
161 Gpio::MM176_INJ7, // 7D - Injector 7
162 Gpio::MM176_INJ8, // 13D - Injector 8
163
164 Gpio::MM176_GP1, // 11D - Main Relay
165 Gpio::MM176_GP2, // 10D - Fan
166// Gpio::MM176_OUT_PWM1, // 8D - VVT 1
167};

Referenced by getBoardMetaOutputs(), and getBoardMetaOutputsCount().

◆ tempPullUp

OutputPin tempPullUp
static

Definition at line 24 of file board_configuration.cpp.

Go to the source code of this file.