using smart chip without having smart chip

This commit is contained in:
rusefillc 2024-02-04 21:24:21 -05:00
parent 6cf99b7a35
commit c65a7dfd33
1 changed files with 6 additions and 47 deletions

View File

@ -88,6 +88,12 @@ void setBoardDefaultConfiguration() {
engineConfiguration->communityCommsLedPid = Gpio::D15; // blue LED on discovery
engineConfiguration->injectionPins[0] = Gpio::MC33810_0_OUT_0;
engineConfiguration->injectionPins[1] = Gpio::MC33810_0_OUT_1;
engineConfiguration->ignitionPins[0] = Gpio::MC33810_0_GD_0;
engineConfiguration->ignitionPins[1] = Gpio::MC33810_0_GD_1;
#if EFI_HIP_9011
setHip9011FrankensoPinout();
#endif /* EFI_HIP_9011 */
@ -146,52 +152,5 @@ void setBoardDefaultConfiguration() {
// weak linkage
void boardInitHardware() {
#if HW_FRANKENSO
static const struct mc33810_config mc33810 = {
.spi_bus = &SPID3,
.spi_config = {
.circular = false,
.end_cb = NULL,
// todo: use engineConfiguration->mc33810_cs
.ssport = GPIOC,
.sspad = 5,
.cr1 =
SPI_CR1_16BIT_MODE |
SPI_CR1_SSM |
SPI_CR1_SSI |
((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) | /* div = 16 */
SPI_CR1_MSTR |
/* SPI_CR1_CPOL | */ // = 0
SPI_CR1_CPHA | // = 1
0,
.cr2 = SPI_CR2_16BIT_MODE
},
.direct_io = {
/* injector drivers */
[0] = {.port = GPIOA, .pad = 3},
[1] = {.port = GPIOA, .pad = 4},
[2] = {.port = nullptr, .pad = 0},
[3] = {.port = nullptr, .pad = 0},
/* ignition pre-drivers */
[4] = {.port = GPIOA, .pad = 0},
[5] = {.port = GPIOA, .pad = 1},
//GPGD mode is not supported yet, ignition mode does not support spi on/off commands
// so ignition signals should be directly driven
[6] = {.port = GPIOD, .pad = 0},
// meaning even if we do not use it we need a pin for now
[7] = {.port = GPIOD, .pad = 1},
},
.en = {.port = GPIOA, .pad = 6} // copy-paste with setMode code!
};
if (engineConfiguration->engineType == engine_type_e::FRANKENSO_TEST_33810) {
int ret = mc33810_add(Gpio::MC33810_0_OUT_0, 0, &mc33810);
efiPrintf("*****************+ mc33810_add %d +*******************", ret);
// todo: add to more appropriate location?
addConsoleAction("injinfo", [](){
efiPrintf("injinfo index=%d", engine->fuelComputer.brokenInjector);
});
}
#endif // HW_FRANKENSO
}