diff --git a/MotorDriver.cpp b/MotorDriver.cpp index 43f5e74..f8dbacf 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -57,7 +57,9 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i getFastPin(F("SIG"),signalPin,fastSignalPin); pinMode(signalPin, OUTPUT); + #ifndef ARDUINO_ARCH_MBED_GIGA fastSignalPin.shadowinout = NULL; + #endif if (HAVE_PORTA(fastSignalPin.inout == &PORTA)) { DIAG(F("Found PORTA pin %d"),signalPin); fastSignalPin.shadowinout = fastSignalPin.inout; @@ -95,7 +97,9 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i getFastPin(F("SIG2"),signalPin2,fastSignalPin2); pinMode(signalPin2, OUTPUT); + #ifndef ARDUINO_ARCH_MBED_ARDUINO fastSignalPin2.shadowinout = NULL; + #endif if (HAVE_PORTA(fastSignalPin2.inout == &PORTA)) { DIAG(F("Found PORTA pin %d"),signalPin2); fastSignalPin2.shadowinout = fastSignalPin2.inout; diff --git a/MotorDriver.h b/MotorDriver.h index 80caf1b..b69a493 100644 --- a/MotorDriver.h +++ b/MotorDriver.h @@ -30,10 +30,9 @@ // use powers of two so we can do logical and/or on the track modes in if clauses. enum TRACK_MODE : byte {TRACK_MODE_NONE = 1, TRACK_MODE_MAIN = 2, TRACK_MODE_PROG = 4, TRACK_MODE_DC = 8, TRACK_MODE_DCX = 16, TRACK_MODE_EXT = 32}; -#if defined(ARDUINO_GIGA) - -#define setHIGH(fastpin) gpio_write(&fastpin, 1) -#define setLOW(fastpin) gpio_write(&fastpin, 0) +#ifdef ARDUINO_ARCH_MBED_GIGA +#define setHIGH(fastpin) (gpio_read(&fastpin)==1) +#define setLOW(fastpin) (gpio_read(&fastpin)==0) #else #define setHIGH(fastpin) *fastpin.inout |= fastpin.maskHIGH #define setLOW(fastpin) *fastpin.inout &= fastpin.maskLOW