diff --git a/MotorDriver.cpp b/MotorDriver.cpp index f8dbacf..f69fbba 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -57,9 +57,8 @@ 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 + #ifndef ARDUINO_GIGA fastSignalPin.shadowinout = NULL; - #endif if (HAVE_PORTA(fastSignalPin.inout == &PORTA)) { DIAG(F("Found PORTA pin %d"),signalPin); fastSignalPin.shadowinout = fastSignalPin.inout; @@ -90,16 +89,15 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i fastSignalPin.shadowinout = fastSignalPin.inout; fastSignalPin.inout = &shadowPORTF; } - + #endif signalPin2=signal_pin2; if (signalPin2!=UNUSED_PIN) { dualSignal=true; getFastPin(F("SIG2"),signalPin2,fastSignalPin2); pinMode(signalPin2, OUTPUT); - #ifndef ARDUINO_ARCH_MBED_ARDUINO + #ifndef ARDUINO_GIGA fastSignalPin2.shadowinout = NULL; - #endif if (HAVE_PORTA(fastSignalPin2.inout == &PORTA)) { DIAG(F("Found PORTA pin %d"),signalPin2); fastSignalPin2.shadowinout = fastSignalPin2.inout; @@ -130,6 +128,7 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i fastSignalPin2.shadowinout = fastSignalPin2.inout; fastSignalPin2.inout = &shadowPORTF; } + #endif } else dualSignal=false; diff --git a/MotorDriver.h b/MotorDriver.h index b69a493..43acb30 100644 --- a/MotorDriver.h +++ b/MotorDriver.h @@ -30,16 +30,20 @@ // 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}; -#ifdef ARDUINO_ARCH_MBED_GIGA -#define setHIGH(fastpin) (gpio_read(&fastpin)==1) -#define setLOW(fastpin) (gpio_read(&fastpin)==0) +#ifdef ARDUINO_GIGA +#define setHIGH(fastpin) gpio_write(&fastpin, 1) +#define setLOW(fastpin) gpio_write(&fastpin, 0) #else #define setHIGH(fastpin) *fastpin.inout |= fastpin.maskHIGH #define setLOW(fastpin) *fastpin.inout &= fastpin.maskLOW #endif +#if defined(ARDUINO_GIGA) +#define isHIGH(fastpin) (gpio_read(&fastpin)==1) +#define isLOW(fastpin) (gpio_read(&fastpin)==0) +#else #define isHIGH(fastpin) (*fastpin.inout & fastpin.maskHIGH) #define isLOW(fastpin) (!isHIGH(fastpin)) - +#endif #define TOKENPASTE(x, y) x ## y #define TOKENPASTE2(x, y) TOKENPASTE(x, y)