rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
board_configuration.cpp
Go to the documentation of this file.
1/**
2 * See https://rusefi.com/s/super-uaefi
3 *
4 * @author Andrey Belomutskiy, (c) 2012-2023
5 */
6
7#include "pch.h"
8#include "defaults.h"
9#include "hellen_meta.h"
10#include "hellen_leds_100.cpp"
11#include "board_overrides.h"
12//#include "connectors/generated_board_pin_names.h"
13
14static void setInjectorPins() {
15 engineConfiguration->injectionPins[0] = Gpio::MM100_INJ1;
16 engineConfiguration->injectionPins[1] = Gpio::MM100_INJ2;
17 engineConfiguration->injectionPins[2] = Gpio::MM100_INJ3;
18 engineConfiguration->injectionPins[3] = Gpio::MM100_INJ4;
19 engineConfiguration->injectionPins[4] = Gpio::MM100_INJ5;
20 engineConfiguration->injectionPins[5] = Gpio::MM100_INJ6;
21}
22
23static void setIgnitionPins() {
24 engineConfiguration->ignitionPins[0] = Gpio::MM100_IGN1;
25 engineConfiguration->ignitionPins[1] = Gpio::MM100_IGN2;
26 engineConfiguration->ignitionPins[2] = Gpio::MM100_IGN3;
27 engineConfiguration->ignitionPins[3] = Gpio::MM100_IGN4;
28 engineConfiguration->ignitionPins[4] = Gpio::MM100_IGN5;
29 engineConfiguration->ignitionPins[5] = Gpio::MM100_IGN6;
30}
31
33 engineConfiguration->tps1_1AdcChannel = MM100_IN_TPS_ANALOG;
34 engineConfiguration->tps1_2AdcChannel = MM100_IN_AUX1_ANALOG;
35// engineConfiguration->map.sensor.hwChannel = PIN_D9;
36
37 setPPSInputs(MM100_IN_PPS_ANALOG, MM100_IN_AUX2_ANALOG);
38
39 engineConfiguration->clt.adcChannel = MM100_IN_CLT_ANALOG;
40 engineConfiguration->iat.adcChannel = MM100_IN_IAT_ANALOG;
41
42 engineConfiguration->triggerInputPins[0] = Gpio::MM100_UART8_TX; // VR2 max9924 is the safer default
43 engineConfiguration->camInputs[0] = Gpio::MM100_IN_D1; // HALL1
44 engineConfiguration->camInputs[1] = Gpio::MM100_IN_D2; // HALL2
45
47}
48
62
64 return true;
65}
66
67static void setDefaultETBPins() {
68 // users would want to override those if using H-bridges for stepper idle control
69 setupTLE9201IncludingStepper(/*PWM controlPin*/Gpio::MM100_OUT_PWM3, Gpio::MM100_OUT_PWM4, Gpio::MM100_SPI2_MISO);
70 setupTLE9201IncludingStepper(/*PWM controlPin*/Gpio::MM100_OUT_PWM5, Gpio::MM100_SPI2_MOSI, Gpio::MM100_USB1ID, 1);
71}
72
73/**
74 * @brief Board-specific configuration defaults.
75 *
76 * See also setDefaultEngineConfiguration
77 *
78 */
83
85
88
90
91 engineConfiguration->canTxPin = Gpio::MM100_CAN_TX;
92 engineConfiguration->canRxPin = Gpio::MM100_CAN_RX;
93
94 engineConfiguration->mainRelayPin = Gpio::MM100_IGN7;
95 engineConfiguration->fanPin = Gpio::MM100_IGN8;
96 engineConfiguration->fuelPumpPin = Gpio::MM100_OUT_PWM2;
97
98 // SPI3 for on-board EGT
100 // MOSI not needed, we have one-way communication here
105
106 // "required" hardware is done - set some reasonable defaults
109
110 engineConfiguration->etbFunctions[0] = DC_Throttle1;
111
112 // Some sensible defaults for other options
114
115 setAlgorithm(engine_load_mode_e::LM_SPEED_DENSITY);
116
117 engineConfiguration->injectorCompensationMode = ICM_FixedRailPressure;
118
119#ifndef EFI_BOOTLOADER
120 setCommonNTCSensor(&engineConfiguration->clt, HELLEN_DEFAULT_AT_PULLUP);
121 setCommonNTCSensor(&engineConfiguration->iat, HELLEN_DEFAULT_AT_PULLUP);
122#endif // EFI_BOOTLOADER
123
124 setTPS1Calibration(100, 650);
125 hellenWbo();
126}
127
128static Gpio OUTPUTS[] = {
129 Gpio::MM100_INJ1, // 13B INJ_1
130 Gpio::MM100_INJ2, // 12B INJ_2
131 Gpio::MM100_INJ3, // 11B INJ_3
132 Gpio::MM100_INJ4, // 10B INJ_4
133 Gpio::MM100_INJ5, // 9B INJ_5
134 Gpio::MM100_INJ6, // 8B INJ_6
135 Gpio::MM100_SPI2_CS, // 19B INJ_7
136 Gpio::MM100_SPI2_SCK, // 18B INJ_8
137 Gpio::MM100_INJ7, // 20B LS1
138 Gpio::MM100_INJ8, // 21B LS2
139 Gpio::MM100_OUT_PWM1, // 22B LS3
140 Gpio::MM100_OUT_PWM2, // 31C LS4
141 Gpio::MM100_IGN7, // 30C LS5_HOT
142 Gpio::MM100_IGN8, // 29C LS6_HOT
143 Gpio::MM100_IGN1, // Coil 1
144 Gpio::MM100_IGN2, // Coil 2
145 Gpio::MM100_IGN3, // Coil 3
146 Gpio::MM100_IGN4, // Coil 4
147 Gpio::MM100_IGN5, // Coil 5
148 Gpio::MM100_IGN6, // Coil 6
149 Gpio::MM100_LED2_GREEN, // 20D High Side Output
150};
151
153 return efi::size(OUTPUTS);
154}
155
159
161 return OUTPUTS;
162}
163
165 return 2;
166}
167
void setup_custom_board_overrides()
void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax)
void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2)
void setupTLE9201IncludingStepper(Gpio controlPin, Gpio direction, Gpio disable, int dcIndex)
std::optional< setup_custom_board_overrides_type > custom_board_ConfigOverrides
std::optional< setup_custom_board_overrides_type > custom_board_DefaultConfiguration
void setCrankOperationMode()
static constexpr engine_configuration_s * engineConfiguration
void setAlgorithm(engine_load_mode_e algo)
static void setupDefaultSensorInputs()
static Gpio OUTPUTS[]
static void setIgnitionPins()
int getBoardMetaOutputsCount()
Gpio * getBoardMetaOutputs()
static void setInjectorPins()
int getBoardMetaLowSideOutputsCount()
int getBoardMetaDcOutputsCount()
static void setDefaultETBPins()
static void super_uaefi_boardConfigOverrides()
bool validateBoardConfig()
static void super_uaefi_boardDefaultConfiguration()
Board-specific configuration defaults.
void hellenMegaSdWithAccelerometer()
void setHellenCan()
void hellenWbo()
void setHellenVbatt()
void setHellenMegaEnPin(bool enableBoardOnStartUp)
void setHellenMMbaro()
void setDefaultHellenAtPullUps(float pullup=HELLEN_DEFAULT_AT_PULLUP)
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
void setCommonNTCSensor(ThermistorConf *thermistorConf, float pullup)