refactoring: time to unify digital pin API
trying to fix build
This commit is contained in:
parent
0570ef4c42
commit
e6abba09a9
|
@ -839,6 +839,6 @@ int getRusEfiVersion(void) {
|
||||||
if (initBootloader() != 0)
|
if (initBootloader() != 0)
|
||||||
return 123;
|
return 123;
|
||||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||||
return 20191110;
|
return 20191112;
|
||||||
}
|
}
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
|
@ -22,6 +22,6 @@ void startTriggerInputPins(void);
|
||||||
void stopTriggerInputPins(void);
|
void stopTriggerInputPins(void);
|
||||||
void setPrimaryChannel(brain_pin_e brainPin);
|
void setPrimaryChannel(brain_pin_e brainPin);
|
||||||
void turnOffTriggerInputPin(brain_pin_e brainPin);
|
void turnOffTriggerInputPin(brain_pin_e brainPin);
|
||||||
void turnOnTriggerInputPin(const char *msg, int index, bool isVvtShaft);
|
void turnOnTriggerInputPin(const char *msg, int index, bool isTriggerShaft);
|
||||||
|
|
||||||
#endif /* CRANK_INPUT_H_ */
|
#endif /* CRANK_INPUT_H_ */
|
||||||
|
|
|
@ -64,8 +64,8 @@ static void cam_callback(void *arg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void turnOnTriggerInputPin(const char *msg, int index, bool isVvtShaft) {
|
void turnOnTriggerInputPin(const char *msg, int index, bool isTriggerShaft) {
|
||||||
brain_pin_e brainPin = isVvtShaft ? engineConfiguration->camInputs[index] : CONFIGB(triggerInputPins)[index];
|
brain_pin_e brainPin = isTriggerShaft ? CONFIGB(triggerInputPins)[index] : engineConfiguration->camInputs[index];
|
||||||
|
|
||||||
scheduleMsg(logger, "turnOnTriggerInputPin(PAL) %s %s", msg, hwPortname(brainPin));
|
scheduleMsg(logger, "turnOnTriggerInputPin(PAL) %s %s", msg, hwPortname(brainPin));
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,12 @@ extern bool hasFirmwareErrorFlag;
|
||||||
|
|
||||||
static Logging *logger;
|
static Logging *logger;
|
||||||
|
|
||||||
static void cam_icu_width_callback(void *arg) {
|
static void vvtWidthCallback(void *arg) {
|
||||||
(void)arg;
|
(void)arg;
|
||||||
hwHandleVvtCamSignal(TV_RISE);
|
hwHandleVvtCamSignal(TV_RISE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cam_icu_period_callback(void *arg) {
|
static void vvtPeriodCallback(void *arg) {
|
||||||
(void)arg;
|
(void)arg;
|
||||||
hwHandleVvtCamSignal(TV_FALL);
|
hwHandleVvtCamSignal(TV_FALL);
|
||||||
}
|
}
|
||||||
|
@ -79,21 +79,21 @@ static void shaftPeriodCallback(bool isPrimary) {
|
||||||
hwHandleShaftSignal(signal);
|
hwHandleShaftSignal(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void turnOnTriggerInputPin(const char *msg, int index, bool isVvtShaft) {
|
void turnOnTriggerInputPin(const char *msg, int index, bool isTriggerShaft) {
|
||||||
|
|
||||||
brain_pin_e brainPin = isVvtShaft ? engineConfiguration->camInputs[index] : CONFIGB(triggerInputPins)[index];
|
brain_pin_e brainPin = isTriggerShaft ? CONFIGB(triggerInputPins)[index] : engineConfiguration->camInputs[index];
|
||||||
if (brainPin == GPIO_UNASSIGNED) {
|
if (brainPin == GPIO_UNASSIGNED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
digital_input_s* input = startDigitalCapture("trigger", brainPin, true);
|
digital_input_s* input = startDigitalCapture("trigger", brainPin, true);
|
||||||
if (isVvtShaft) {
|
if (isTriggerShaft) {
|
||||||
input->setWidthCallback((VoidInt)(void*)shaftWidthCallback, NULL);
|
|
||||||
input->setPeriodCallback((VoidInt)(void*)shaftPeriodCallback, NULL);
|
|
||||||
} else {
|
|
||||||
void * arg = (void*) (index == 0);
|
void * arg = (void*) (index == 0);
|
||||||
input->setWidthCallback((VoidInt)(void*)shaftWidthCallback, arg);
|
input->setWidthCallback((VoidInt)(void*)shaftWidthCallback, arg);
|
||||||
input->setPeriodCallback((VoidInt)(void*)shaftPeriodCallback, arg);
|
input->setPeriodCallback((VoidInt)(void*)shaftPeriodCallback, arg);
|
||||||
|
} else {
|
||||||
|
input->setWidthCallback((VoidInt)(void*)vvtWidthCallback, NULL);
|
||||||
|
input->setPeriodCallback((VoidInt)(void*)vvtPeriodCallback, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue