REVERT need to get master green
This commit is contained in:
parent
23c6ec59a3
commit
656acd1788
|
@ -23,23 +23,23 @@
|
||||||
static ioportmask_t ext_used = 0;
|
static ioportmask_t ext_used = 0;
|
||||||
|
|
||||||
// EXT is not able to give you the front direction but you could read the pin in the callback.
|
// EXT is not able to give you the front direction but you could read the pin in the callback.
|
||||||
int efiExtiEnablePin(const char *msg, brain_pin_e brainPin, uint32_t mode, palcallback_t cb, void *cb_data) {
|
void efiExtiEnablePin(const char *msg, brain_pin_e brainPin, uint32_t mode, palcallback_t cb, void *cb_data) {
|
||||||
|
|
||||||
/* paranoid check, in case of GPIO_UNASSIGNED getHwPort will return NULL
|
/* paranoid check, in case of GPIO_UNASSIGNED getHwPort will return NULL
|
||||||
* and we will fail on next check */
|
* and we will fail on next check */
|
||||||
if (brainPin == GPIO_UNASSIGNED)
|
if (brainPin == GPIO_UNASSIGNED)
|
||||||
return -1;
|
return;
|
||||||
|
|
||||||
ioportid_t port = getHwPort(msg, brainPin);
|
ioportid_t port = getHwPort(msg, brainPin);
|
||||||
if (port == NULL)
|
if (port == NULL)
|
||||||
return -1;
|
return;
|
||||||
|
|
||||||
int index = getHwPin(msg, brainPin);
|
int index = getHwPin(msg, brainPin);
|
||||||
|
|
||||||
/* is this index already used? */
|
/* is this index already used? */
|
||||||
if (ext_used & PAL_PORT_BIT(index)) {
|
if (ext_used & PAL_PORT_BIT(index)) {
|
||||||
firmwareError(CUSTOM_ERR_PIN_ALREADY_USED_2, "%s: pin %d: exti index already used", msg, brainPin);
|
firmwareError(CUSTOM_ERR_PIN_ALREADY_USED_2, "%s: pin %d: exti index already used", msg, brainPin);
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ioline_t line = PAL_LINE(port, index);
|
ioline_t line = PAL_LINE(port, index);
|
||||||
|
@ -48,8 +48,6 @@ int efiExtiEnablePin(const char *msg, brain_pin_e brainPin, uint32_t mode, palca
|
||||||
|
|
||||||
/* mark used */
|
/* mark used */
|
||||||
ext_used |= PAL_PORT_BIT(index);
|
ext_used |= PAL_PORT_BIT(index);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void efiExtiDisablePin(brain_pin_e brainPin)
|
void efiExtiDisablePin(brain_pin_e brainPin)
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
#include "digital_input.h"
|
#include "digital_input.h"
|
||||||
|
|
||||||
#if HAL_USE_PAL
|
#if HAL_USE_PAL
|
||||||
int efiExtiEnablePin(const char *msg, brain_pin_e pin, uint32_t mode, palcallback_t cb, void *cb_data);
|
void efiExtiEnablePin(const char *msg, brain_pin_e pin, uint32_t mode, palcallback_t cb, void *cb_data);
|
||||||
void efiExtiDisablePin(brain_pin_e brainPin);
|
void efiExtiDisablePin(brain_pin_e brainPin);
|
||||||
#endif /* HAL_USE_PAL */
|
#endif /* HAL_USE_PAL */
|
||||||
|
|
|
@ -221,6 +221,7 @@ void stopDigitalCapture(const char *msg, brain_pin_e brainPin) {
|
||||||
if (brainPin == GPIO_UNASSIGNED) {
|
if (brainPin == GPIO_UNASSIGNED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
brain_pin_markUnused(brainPin);
|
||||||
|
|
||||||
ICUDriver *driver = getInputCaptureDriver(msg, brainPin);
|
ICUDriver *driver = getInputCaptureDriver(msg, brainPin);
|
||||||
if (driver == NULL) {
|
if (driver == NULL) {
|
||||||
|
|
|
@ -82,7 +82,6 @@ static int turnOnTriggerInputPin(const char *msg, int index, bool isTriggerShaft
|
||||||
shaftTriggerType[index] = TRIGGER_ICU;
|
shaftTriggerType[index] = TRIGGER_ICU;
|
||||||
else
|
else
|
||||||
camTriggerType[index] = TRIGGER_ICU;
|
camTriggerType[index] = TRIGGER_ICU;
|
||||||
brain_pin_markUsed(brainPin, msg);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -93,7 +92,6 @@ static int turnOnTriggerInputPin(const char *msg, int index, bool isTriggerShaft
|
||||||
shaftTriggerType[index] = TRIGGER_EXTI;
|
shaftTriggerType[index] = TRIGGER_EXTI;
|
||||||
else
|
else
|
||||||
camTriggerType[index] = TRIGGER_EXTI;
|
camTriggerType[index] = TRIGGER_EXTI;
|
||||||
brain_pin_markUsed(brainPin, msg);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +123,6 @@ static void turnOffTriggerInputPin(int index, bool isTriggerShaft) {
|
||||||
|
|
||||||
camTriggerType[index] = TRIGGER_NONE;
|
camTriggerType[index] = TRIGGER_NONE;
|
||||||
}
|
}
|
||||||
brain_pin_markUnused(brainPin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================================================*/
|
/*==========================================================================*/
|
||||||
|
|
|
@ -76,7 +76,6 @@ static void cam_callback(void *arg) {
|
||||||
/*==========================================================================*/
|
/*==========================================================================*/
|
||||||
|
|
||||||
int extiTriggerTurnOnInputPin(const char *msg, int index, bool isTriggerShaft) {
|
int extiTriggerTurnOnInputPin(const char *msg, int index, bool isTriggerShaft) {
|
||||||
int ret;
|
|
||||||
brain_pin_e brainPin = isTriggerShaft ? CONFIG(triggerInputPins)[index] : engineConfiguration->camInputs[index];
|
brain_pin_e brainPin = isTriggerShaft ? CONFIG(triggerInputPins)[index] : engineConfiguration->camInputs[index];
|
||||||
|
|
||||||
scheduleMsg(logger, "extiTriggerTurnOnInputPin %s %s", msg, hwPortname(brainPin));
|
scheduleMsg(logger, "extiTriggerTurnOnInputPin %s %s", msg, hwPortname(brainPin));
|
||||||
|
@ -84,10 +83,8 @@ int extiTriggerTurnOnInputPin(const char *msg, int index, bool isTriggerShaft) {
|
||||||
/* TODO:
|
/* TODO:
|
||||||
* * do not set to both edges if we need only one
|
* * do not set to both edges if we need only one
|
||||||
* * simplify callback in case of one edge */
|
* * simplify callback in case of one edge */
|
||||||
ioline_t pal_line = PAL_LINE(getHwPort(msg, brainPin), getHwPin(msg, brainPin));
|
ioline_t pal_line = PAL_LINE(getHwPort("trg", brainPin), getHwPin("trg", brainPin));
|
||||||
ret = efiExtiEnablePin(msg, brainPin, PAL_EVENT_MODE_BOTH_EDGES, isTriggerShaft ? shaft_callback : cam_callback, (void *)pal_line);
|
efiExtiEnablePin(msg, brainPin, PAL_EVENT_MODE_BOTH_EDGES, isTriggerShaft ? shaft_callback : cam_callback, (void *)pal_line);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue