1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

Merge branch 'PORTX_HAL' of https://github.com/DCC-EX/CommandStation-EX into PORTX_HAL

This commit is contained in:
Harald Barth 2022-08-13 17:37:37 +02:00
commit 82bcae627b

View File

@ -147,10 +147,12 @@ class MotorDriver {
inline pinpair getSignalPin() { return pinpair(signalPin,signalPin2); }; inline pinpair getSignalPin() { return pinpair(signalPin,signalPin2); };
virtual void setDCSignal(byte speedByte); virtual void setDCSignal(byte speedByte);
inline void detachDCSignal() { inline void detachDCSignal() {
#ifndef ARDUINO_ARCH_ESP32 #if defined(__arm__)
setDCSignal(128); pinMode(brakePin, OUTPUT);
#else #elif defined(ARDUINO_ARCH_ESP32)
ledcDetachPin(brakePin); ledcDetachPin(brakePin);
#else
setDCSignal(128);
#endif #endif
}; };
virtual int getCurrentRaw(); virtual int getCurrentRaw();
@ -158,7 +160,8 @@ class MotorDriver {
virtual unsigned int raw2mA( int raw); virtual unsigned int raw2mA( int raw);
virtual unsigned int mA2raw( unsigned int mA); virtual unsigned int mA2raw( unsigned int mA);
inline bool brakeCanPWM() { inline bool brakeCanPWM() {
#ifdef ARDUINO_ARCH_ESP32 #if defined(ARDUINO_ARCH_ESP32) || defined(__arm__)
// TODO: on ARM we can use digitalPinHasPWM, and may wish/need to
return true; return true;
#else #else
#ifdef digitalPinToTimer #ifdef digitalPinToTimer
@ -166,7 +169,7 @@ class MotorDriver {
#else #else
return (brakePin<14 && brakePin >1); return (brakePin<14 && brakePin >1);
#endif //digitalPinToTimer #endif //digitalPinToTimer
#endif //ESP32 #endif //ESP32/ARM
} }
inline int getRawCurrentTripValue() { inline int getRawCurrentTripValue() {
return rawCurrentTripValue; return rawCurrentTripValue;