1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-28 09:53:45 +02:00

inline setSignal ; bugfix HA switching code by doing clearPWM

This commit is contained in:
Harald Barth
2022-05-10 23:37:24 +02:00
parent ac32cd5528
commit 4a56998553
8 changed files with 45 additions and 27 deletions

View File

@@ -25,11 +25,6 @@
#include "DCCTimer.h"
#include "DIAG.h"
#define setHIGH(fastpin) *fastpin.inout |= fastpin.maskHIGH
#define setLOW(fastpin) *fastpin.inout &= fastpin.maskLOW
#define isHIGH(fastpin) (*fastpin.inout & fastpin.maskHIGH)
#define isLOW(fastpin) (!isHIGH(fastpin))
bool MotorDriver::usePWM=false;
bool MotorDriver::commonFaultPin=false;
@@ -119,23 +114,6 @@ void MotorDriver::setBrake(bool on) {
else setLOW(fastBrakePin);
}
void MotorDriver::setSignal( bool high) {
if (usePWM) {
DCCTimer::setPWM(signalPin,high);
}
else {
if (high) {
setHIGH(fastSignalPin);
if (dualSignal) setLOW(fastSignalPin2);
}
else {
setLOW(fastSignalPin);
if (dualSignal) setHIGH(fastSignalPin2);
}
}
}
bool MotorDriver::canMeasureCurrent() {
return currentPin!=UNUSED_PIN;
}