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

SAMD fixups and workaround

This commit is contained in:
Asbelos 2022-07-08 10:34:27 +01:00
parent 385afdeb6c
commit aa3c3c2ee4

View File

@ -64,14 +64,11 @@
#endif #endif
#if defined(__IMXRT1062__) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_SAMD) #if defined(__IMXRT1062__) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_SAMD)
struct FASTPIN { typedef uint32_t portreg_t;
volatile uint32_t *inout;
uint32_t maskHIGH;
uint32_t maskLOW;
};
#else #else
typedef uint8_t portreg_t; typedef uint8_t portreg_t;
#endif #endif
struct FASTPIN { struct FASTPIN {
volatile portreg_t *inout; volatile portreg_t *inout;
portreg_t maskHIGH; portreg_t maskHIGH;
@ -122,7 +119,11 @@ 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 digitalPinToTimer
return ((brakePin!=UNUSED_PIN) && (digitalPinToTimer(brakePin))); return ((brakePin!=UNUSED_PIN) && (digitalPinToTimer(brakePin)));
#else
return (brakePin<14 && brakePin >1);
#endif
} }
inline int getRawCurrentTripValue() { inline int getRawCurrentTripValue() {
return rawCurrentTripValue; return rawCurrentTripValue;