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

Functions

static void setDefaultFrankensoStepperIdleParameters ()
 
static void setCanFrankensoDefaults ()
 
Gpio getWarningLedPin ()
 
Gpio getCommsLedPin ()
 
Gpio getRunningLedPin ()
 
static void configureAccelerometerPins ()
 
static void f407_discovery_DefaultConfiguration ()
 Hardware board-specific default configuration (GPIO pins, ADC channels, SPI configs etc.)
 
void f407_discovery_boardInitHardware ()
 
void setup_custom_board_overrides ()
 

Function Documentation

◆ configureAccelerometerPins()

static void configureAccelerometerPins ( )
static

Definition at line 42 of file board_configuration.cpp.

42 {
43// engineConfiguration->accelerometerCsPin = Gpio::E3; // we have a conflict with VVT output on Miata
44// engineConfiguration->is_enabled_spi_1 = true; // we have a conflict with PA5 input pin
45
46 // stm32f4discovery defaults
50}
static constexpr engine_configuration_s * engineConfiguration

Referenced by f407_discovery_DefaultConfiguration().

Here is the caller graph for this function:

◆ f407_discovery_boardInitHardware()

void f407_discovery_boardInitHardware ( )

Definition at line 116 of file board_configuration.cpp.

116 {
117
118static const struct mc33810_config mc33810 = {
119 .spi_bus = &SPID3,
120 .spi_config = {
121 .circular = false,
122#ifdef _CHIBIOS_RT_CONF_VER_6_1_
123 .end_cb = nullptr,
124#else
125 .slave = false,
126 .data_cb = nullptr,
127 .error_cb = nullptr,
128#endif
129 // todo: use engineConfiguration->mc33810_cs
130 .ssport = GPIOC,
131 .sspad = 5,
132 .cr1 =
133 SPI_CR1_16BIT_MODE |
134 SPI_CR1_SSM |
135 SPI_CR1_SSI |
136 ((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) | /* div = 16 */
137 SPI_CR1_MSTR |
138 /* SPI_CR1_CPOL | */ // = 0
139 SPI_CR1_CPHA | // = 1
140 0,
141 .cr2 = SPI_CR2_16BIT_MODE
142 },
143 .direct_io = {
144 /* injector drivers */
145 [0] = {.port = GPIOA, .pad = 3},
146 [1] = {.port = GPIOA, .pad = 4},
147 [2] = {.port = nullptr, .pad = 0},
148 [3] = {.port = nullptr, .pad = 0},
149 /* ignition pre-drivers */
150 [4] = {.port = GPIOA, .pad = 0},
151 [5] = {.port = GPIOA, .pad = 1},
152//GPGD mode is not supported yet, ignition mode does not support spi on/off commands
153// so ignition signals should be directly driven
154 [6] = {.port = GPIOD, .pad = 0},
155// meaning even if we do not use it we need a pin for now
156 [7] = {.port = GPIOD, .pad = 1},
157 },
158 .en = {.port = GPIOA, .pad = 6}, // copy-paste with setMode code!
159 // TODO: pick from engineConfiguration->spi3sckPin or whatever SPI is used
160 .sck = {.port = GPIOB, .pad = 3},
161 .spkdur = Gpio::Unassigned,
162 .nomi = Gpio::Unassigned,
163 .maxi = Gpio::Unassigned
164};
165
168 efiPrintf("*****************+ mc33810_add %d +*******************", ret);
169
170#ifndef EFI_BOOTLOADER
171 // todo: add to more appropriate location?
172 addConsoleAction("injinfo", [](){
173 efiPrintf("injinfo index=%d", engine->fuelComputer.brokenInjector);
174 });
175#endif // EFI_BOOTLOADER
176 }
177}
FuelComputer fuelComputer
Definition engine.h:139
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
@ Unassigned
@ MC33810_0_OUT_0
static EngineAccessor engine
Definition engine.h:413
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
SPIDriver * spi_bus
Definition mc33810.h:30

Referenced by setup_custom_board_overrides().

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

◆ f407_discovery_DefaultConfiguration()

static void f407_discovery_DefaultConfiguration ( )
static

Hardware board-specific default configuration (GPIO pins, ADC channels, SPI configs etc.)

Definition at line 56 of file board_configuration.cpp.

56 {
59
60#ifndef HW_NOT_COMMUNITY_FRANKENSO
61 // f407-discovery community board not frankenso
62 config->communityCommsLedPin = Gpio::D15; // blue LED on discovery
63#endif
64
65 // set optional subsystem configs
66#if EFI_ONBOARD_MEMS
67 // this would override some values from above
69#endif /* EFI_ONBOARD_MEMS */
70
71
72
76 engineConfiguration->afr.hwChannel = EFI_ADC_14;
77
79
82
84// engineConfiguration->triggerInputPins[1] = Gpio::A5;
85
86 // set this to SPI_DEVICE_3 to enable stimulation
87 //engineConfiguration->digitalPotentiometerSpiDevice = SPI_DEVICE_3;
92
95 engineConfiguration->spi1sckPin = Gpio::B3; // please note that this pin is also SWO/SWD - Single Wire debug Output
96
100
104
105
106
107#if EFI_FILE_LOGGING
109#endif /* EFI_FILE_LOGGING */
110
114}
void setDefaultSdCardParameters()
static constexpr persistent_config_s * config
static void configureAccelerometerPins()
static void setDefaultFrankensoStepperIdleParameters()
static void setCanFrankensoDefaults()
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:

◆ getCommsLedPin()

Gpio getCommsLedPin ( )

Definition at line 26 of file board_configuration.cpp.

26 {
27#if defined(HW_NOT_COMMUNITY_FRANKENSO) || defined(EFI_BOOTLOADER)
28 // not f407-discovery but f407-discovery while reusing board file
29 return Gpio::D15;
30#else
31 // f407-discovery community board not frankenso
33#endif
34}

◆ getRunningLedPin()

Gpio getRunningLedPin ( )

Definition at line 36 of file board_configuration.cpp.

36 {
37 // open question if we need those LEDs at all? shall those be configurable?
38 return Gpio::Unassigned;
39}

◆ getWarningLedPin()

Gpio getWarningLedPin ( )

Definition at line 21 of file board_configuration.cpp.

21 {
22 // open question if we need those LEDs at all? shall those be configurable?
23 return Gpio::Unassigned;
24}

◆ setCanFrankensoDefaults()

static void setCanFrankensoDefaults ( )
static

◆ setDefaultFrankensoStepperIdleParameters()

static void setDefaultFrankensoStepperIdleParameters ( )
static

◆ setup_custom_board_overrides()

void setup_custom_board_overrides ( )

Definition at line 179 of file board_configuration.cpp.

179 {
182}
std::optional< setup_custom_board_overrides_type > custom_board_InitHardware
Definition hardware.cpp:77
std::optional< setup_custom_board_overrides_type > custom_board_DefaultConfiguration
static void f407_discovery_DefaultConfiguration()
Hardware board-specific default configuration (GPIO pins, ADC channels, SPI configs etc....
void f407_discovery_boardInitHardware()
Here is the call graph for this function:

Go to the source code of this file.