digital input stop
This commit is contained in:
parent
02cc038886
commit
0215c2c33f
|
@ -189,12 +189,35 @@ digital_input_s * initWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin)
|
|||
digital_input_s *hw = registeredIcus.add();
|
||||
hw->widthListeners.clear();
|
||||
hw->periodListeners.clear();
|
||||
hw->started = false;
|
||||
hw->brainPin = brainPin;
|
||||
hw->driver = driver;
|
||||
turnOnCapturePin(msg, brainPin);
|
||||
return hw;
|
||||
}
|
||||
|
||||
void stopWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
|
||||
if (brainPin == GPIO_UNASSIGNED) {
|
||||
return;
|
||||
}
|
||||
unmarkPin(brainPin);
|
||||
|
||||
ICUDriver *driver = getInputCaptureDriver(msg, brainPin);
|
||||
if (driver == NULL) {
|
||||
return;
|
||||
}
|
||||
int regSize = registeredIcus.size;
|
||||
for (int i = 0; i < regSize; i++) {
|
||||
if (registeredIcus.elements[i].driver == driver) {
|
||||
// removing from driver from the list of used drivers
|
||||
memcpy(®isteredIcus.elements[i], ®isteredIcus.elements[regSize - 1],
|
||||
sizeof(digital_input_s));
|
||||
registeredIcus.size--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void startInputDriver(digital_input_s *hw, bool isActiveHigh) {
|
||||
hw->isActiveHigh = isActiveHigh;
|
||||
if (hw->isActiveHigh) {
|
||||
|
|
|
@ -28,6 +28,7 @@ digital_input_s *initWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
|||
void startInputDriver(digital_input_s *hw, bool isActiveHigh);
|
||||
ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin);
|
||||
icuchannel_t getInputCaptureChannel(brain_pin_e hwPin);
|
||||
void stopWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,8 +67,7 @@ bool hasVehicleSpeedSensor() {
|
|||
}
|
||||
|
||||
void stopVSSPins(void) {
|
||||
unmarkPin(activeConfiguration.bc.vehicleSpeedSensorInputPin);
|
||||
// todo: remove driver from registeredIcus
|
||||
stopWaveAnalyzerDriver("VSS", activeConfiguration.bc.vehicleSpeedSensorInputPin);
|
||||
}
|
||||
|
||||
void startVSSPins(void) {
|
||||
|
|
Loading…
Reference in New Issue