hip9011: fix reinitialization, typos

This commit is contained in:
Andrey Gusakov 2024-06-27 16:02:59 +03:00 committed by rusefillc
parent aa77ed7c56
commit 299ea0dc82
3 changed files with 20 additions and 18 deletions

View File

@ -369,7 +369,7 @@ void applyNewHardwareSettings() {
#endif /* EFI_AUX_SERIAL */ #endif /* EFI_AUX_SERIAL */
#if EFI_HIP_9011 #if EFI_HIP_9011
stopHip9001_pins(); stopHip9011_pins();
#endif /* EFI_HIP_9011 */ #endif /* EFI_HIP_9011 */
stopHardware(); stopHardware();
@ -423,7 +423,7 @@ void applyNewHardwareSettings() {
#if EFI_HIP_9011 #if EFI_HIP_9011
startHip9001_pins(); startHip9011_pins();
#endif /* EFI_HIP_9011 */ #endif /* EFI_HIP_9011 */

View File

@ -283,7 +283,7 @@ void hip9011_onFireEvent(uint8_t cylinderNumber, efitick_t nowNt) {
return; return;
/* We are not checking here for READY_TO_INTEGRATE state as /* We are not checking here for READY_TO_INTEGRATE state as
* previous integration may be stil in progress, while * previous integration may be still in progress, while
* we are scheduling next integration start only * we are scheduling next integration start only
* knockDetectionWindowStart from now. * knockDetectionWindowStart from now.
* Check for correct state will be done at startIntegration () */ * Check for correct state will be done at startIntegration () */
@ -391,7 +391,7 @@ static int hip_init() {
* Now we dont care for return value */ * Now we dont care for return value */
instance.hw->sendSyncCommand(SET_ADVANCED_MODE_CMD, &rx); instance.hw->sendSyncCommand(SET_ADVANCED_MODE_CMD, &rx);
if (rx != SET_ADVANCED_MODE_REP) { if (rx != SET_ADVANCED_MODE_REP) {
/* this is realy a communication problem */ /* this is really a communication problem */
return ret; return ret;
} }
} }
@ -527,22 +527,20 @@ static msg_t hipThread(void *arg) {
/* Exported functions. */ /* Exported functions. */
/*==========================================================================*/ /*==========================================================================*/
void stopHip9001_pins() { void stopHip9011_pins() {
intHold.deInit(); intHold.deInit();
Cs.deInit(); Cs.deInit();
#if EFI_PROD_CODE #if EFI_PROD_CODE
spi = NULL;
hipSpiCfg.ssport = NULL; hipSpiCfg.ssport = NULL;
#endif #endif
} }
void startHip9001_pins() { void startHip9011_pins() {
intHold.initPin("hip int/hold", engineConfiguration->hip9011IntHoldPin, engineConfiguration->hip9011IntHoldPinMode); intHold.initPin("hip int/hold", engineConfiguration->hip9011IntHoldPin, engineConfiguration->hip9011IntHoldPinMode);
intHold.setValue(1);
Cs.initPin("hip CS", engineConfiguration->hip9011CsPin, engineConfiguration->hip9011CsPinMode); Cs.initPin("hip CS", engineConfiguration->hip9011CsPin, engineConfiguration->hip9011CsPinMode);
} Cs.setValue(1);
void initHip9011() {
if (!engineConfiguration->isHip9011Enabled)
return;
#if EFI_PROD_CODE #if EFI_PROD_CODE
spi = getSpiDevice(engineConfiguration->hip9011SpiDevice); spi = getSpiDevice(engineConfiguration->hip9011SpiDevice);
@ -550,12 +548,16 @@ void initHip9011() {
// error already reported // error already reported
return; return;
} }
hipSpiCfg.ssport = getHwPort("hip", engineConfiguration->hip9011CsPin); hipSpiCfg.ssport = getHwPort("hip", engineConfiguration->hip9011CsPin);
hipSpiCfg.sspad = getHwPin("hip", engineConfiguration->hip9011CsPin); hipSpiCfg.sspad = getHwPin("hip", engineConfiguration->hip9011CsPin);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
}
startHip9001_pins(); void initHip9011() {
if (!engineConfiguration->isHip9011Enabled)
return;
startHip9011_pins();
/* load settings */ /* load settings */
instance.prescaler = engineConfiguration->hip9011PrescalerAndSDO; instance.prescaler = engineConfiguration->hip9011PrescalerAndSDO;

View File

@ -11,8 +11,8 @@
#define HIP_THREAD_PERIOD 100 #define HIP_THREAD_PERIOD 100
void initHip9011(); void initHip9011();
void startHip9001_pins(); void startHip9011_pins();
void stopHip9001_pins(); void stopHip9011_pins();
#if HAL_USE_ADC #if HAL_USE_ADC
void hipAdcCallback(float volts); void hipAdcCallback(float volts);
#endif /* HAL_USE_ADC */ #endif /* HAL_USE_ADC */