This commit is contained in:
rusefi 2019-04-21 13:25:36 -04:00
commit 4ee5eddc8f
1 changed files with 8 additions and 6 deletions

View File

@ -129,14 +129,16 @@ struct tle8888_config tle8888_cfg = {
void initSmartGpio() {
startSmartCsPins();
int ret;
int ret = -1;
#if (BOARD_TLE6240_COUNT > 0)
if (engineConfiguration->tle6240_cs != GPIO_UNASSIGNED) {
tle6240.spi_config.ssport = getHwPort("tle6240 CS", engineConfiguration->tle6240_cs);
tle6240.spi_config.sspad = getHwPin("tle6240 CS", engineConfiguration->tle6240_cs);
tle6240.spi_bus = getSpiDevice(engineConfiguration->tle6240spiDevice);
ret = tle6240_add(0, &tle6240);
} else {
ret = 0;
ret = -1;
}
if (ret < 0)
#endif /* (BOARD_TLE6240_COUNT > 0) */
@ -146,13 +148,13 @@ void initSmartGpio() {
#if (BOARD_MC33972_COUNT > 0)
if (boardConfiguration->mc33972_cs != GPIO_UNASSIGNED) {
// todo: reuse initSpiCs method?
mc33972.spi_config.ssport = getHwPort("tle8888 CS", boardConfiguration->mc33972_cs);
mc33972.spi_config.sspad = getHwPin("tle8888 CS", boardConfiguration->mc33972_cs);
mc33972.spi_config.ssport = getHwPort("mc33972 CS", boardConfiguration->mc33972_cs);
mc33972.spi_config.sspad = getHwPin("mc33972 CS", boardConfiguration->mc33972_cs);
mc33972.spi_bus = getSpiDevice(engineConfiguration->mc33972spiDevice);
// todo: propogate 'basePinOffset' parameter
ret = mc33972_add(0, &mc33972);
} else {
ret = 0;
ret = -1;
}
if (ret < 0)
#endif /* (BOARD_MC33972_COUNT > 0) */
@ -173,7 +175,7 @@ void initSmartGpio() {
efiAssertVoid(OBD_PCM_Processor_Fault, ret == TLE8888_PIN_1, "tle8888");
} else {
ret = 0;
ret = -1;
}
if (ret < 0)
#endif /* (BOARD_TLE6240_COUNT > 0) */