looks like this part of refactoring is good?
This commit is contained in:
parent
c9b994ba0d
commit
e33798c214
|
@ -117,7 +117,7 @@ static void initWave(const char *name, int index) {
|
|||
if (reader->hw != NULL) {
|
||||
reader->hw->setWidthCallback((VoidInt)(void*) waAnaWidthCallback, (void*) reader);
|
||||
|
||||
reader->hw->setPeridoCallback((VoidInt)(void*) waIcuPeriodCallback, (void*) reader);
|
||||
reader->hw->setPeriodCallback((VoidInt)(void*) waIcuPeriodCallback, (void*) reader);
|
||||
}
|
||||
|
||||
print("wave%d input on %s\r\n", index, hwPortname(brainPin));
|
||||
|
|
|
@ -11,6 +11,6 @@ void digital_input_s::setWidthCallback(VoidInt handler, void *arg) {
|
|||
widthListeners.registerCallback(handler, arg);
|
||||
}
|
||||
|
||||
void digital_input_s::setPeridoCallback(VoidInt handler, void *arg) {
|
||||
void digital_input_s::setPeriodCallback(VoidInt handler, void *arg) {
|
||||
periodListeners.registerCallback(handler, arg);
|
||||
}
|
||||
|
|
|
@ -23,5 +23,5 @@ typedef struct {
|
|||
|
||||
// Width/Period names are historically inherited from ICU implementation, todo: migrate to better names, high/low? rise/hall?
|
||||
void setWidthCallback(VoidInt handler, void *arg);
|
||||
void setPeridoCallback(VoidInt handler, void *arg);
|
||||
void setPeriodCallback(VoidInt handler, void *arg);
|
||||
} digital_input_s;
|
||||
|
|
|
@ -23,23 +23,23 @@
|
|||
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.
|
||||
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
|
||||
* and we will fail on next check */
|
||||
if (brainPin == GPIO_UNASSIGNED)
|
||||
return -1;
|
||||
return;
|
||||
|
||||
ioportid_t port = getHwPort(msg, brainPin);
|
||||
if (port == NULL)
|
||||
return -1;
|
||||
return;
|
||||
|
||||
int index = getHwPin(msg, brainPin);
|
||||
|
||||
/* is this index already used? */
|
||||
if (ext_used & PAL_PORT_BIT(index)) {
|
||||
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);
|
||||
|
@ -48,8 +48,6 @@ int efiExtiEnablePin(const char *msg, brain_pin_e brainPin, uint32_t mode, palca
|
|||
|
||||
/* mark used */
|
||||
ext_used |= PAL_PORT_BIT(index);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void efiExtiDisablePin(brain_pin_e brainPin)
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
#include "digital_input.h"
|
||||
|
||||
#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);
|
||||
#endif /* HAL_USE_PAL */
|
||||
|
|
|
@ -233,7 +233,7 @@ digital_input_s * addWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
|
|||
/**
|
||||
* turns pin off and returns digital_input_s back into registeredIcus pool
|
||||
*/
|
||||
void removeWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
|
||||
void stopDigitalCapture(const char *msg, brain_pin_e brainPin) {
|
||||
if (brainPin == GPIO_UNASSIGNED) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ void turnOffCapturePin(brain_pin_e brainPin);
|
|||
digital_input_s *addWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
||||
void startInputDriver(const char *msg, /*nullable*/digital_input_s *hw, bool isActiveHigh);
|
||||
|
||||
void removeWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
||||
void stopDigitalCapture(const char *msg, brain_pin_e brainPin);
|
||||
|
||||
//Nullable
|
||||
ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin);
|
||||
|
|
|
@ -67,7 +67,7 @@ bool hasVehicleSpeedSensor() {
|
|||
}
|
||||
|
||||
void stopVSSPins(void) {
|
||||
removeWaveAnalyzerDriver("VSS", activeConfiguration.bc.vehicleSpeedSensorInputPin);
|
||||
stopDigitalCapture("VSS", activeConfiguration.bc.vehicleSpeedSensorInputPin);
|
||||
}
|
||||
|
||||
void startVSSPins(void) {
|
||||
|
|
Loading…
Reference in New Issue