From 071b1acb8e4962beba778b879c5cae406dafbee0 Mon Sep 17 00:00:00 2001 From: rusefi Date: Wed, 13 Nov 2019 22:50:37 -0500 Subject: [PATCH] refactoring: time to unify digital pin API --- firmware/hw_layer/trigger_input_exti.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/firmware/hw_layer/trigger_input_exti.cpp b/firmware/hw_layer/trigger_input_exti.cpp index 493a153725..c6beacbb6b 100644 --- a/firmware/hw_layer/trigger_input_exti.cpp +++ b/firmware/hw_layer/trigger_input_exti.cpp @@ -64,18 +64,20 @@ static void cam_callback(void *arg) { } } -int turnOnTriggerInputPin(const char *msg, brain_pin_e brainPin, bool isVvtShaft) { +void turnOnTriggerInputPin(const char *msg, int index, bool isTriggerShaft) { + brain_pin_e brainPin = isTriggerShaft ? CONFIGB(triggerInputPins)[index] : engineConfiguration->camInputs[index]; + scheduleMsg(logger, "turnOnTriggerInputPin(PAL) %s %s", msg, hwPortname(brainPin)); /* TODO: * * do not set to both edges if we need only one * * simplify callback in case of one edge */ ioline_t pal_line = PAL_LINE(getHwPort("trg", brainPin), getHwPin("trg", brainPin)); - return efiExtiEnablePin(msg, brainPin, PAL_EVENT_MODE_BOTH_EDGES, isVvtShaft ? shaft_callback : cam_callback, (void *)pal_line); + efiExtiEnablePin(msg, brainPin, PAL_EVENT_MODE_BOTH_EDGES, isVvtShaft ? shaft_callback : cam_callback, (void *)pal_line); } void turnOffTriggerInputPin(brain_pin_e brainPin) { - efiExtiDisablePin(brainPin); + stopDigitalCapture("trigger", brainPin); } void setPrimaryChannel(brain_pin_e brainPin) {