1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +01:00

move all arch dependent port register declarations to MotorDriver.h

This commit is contained in:
Harald Barth 2022-06-13 23:15:35 +02:00
parent 744713769c
commit 4833eaac65
4 changed files with 18 additions and 23 deletions

View File

@ -1 +1 @@
#define GITHUB_SHA "TM-PORTX-20220611-1" #define GITHUB_SHA "TM-PORTX-20220613"

View File

@ -27,9 +27,9 @@
bool MotorDriver::commonFaultPin=false; bool MotorDriver::commonFaultPin=false;
volatile byte fakePORTA; volatile portreg_t fakePORTA;
volatile byte fakePORTB; volatile portreg_t fakePORTB;
volatile byte fakePORTC; volatile portreg_t fakePORTC;
MotorDriver::MotorDriver(VPIN power_pin, byte signal_pin, byte signal_pin2, int8_t brake_pin, MotorDriver::MotorDriver(VPIN power_pin, byte signal_pin, byte signal_pin2, int8_t brake_pin,
byte current_pin, float sense_factor, unsigned int trip_milliamps, byte fault_pin) { byte current_pin, float sense_factor, unsigned int trip_milliamps, byte fault_pin) {

View File

@ -63,20 +63,22 @@
#endif #endif
#if defined(__IMXRT1062__) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) #if defined(__IMXRT1062__) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
struct FASTPIN { typedef uint32_t portreg_t;
volatile uint32_t *inout;
uint32_t maskHIGH;
uint32_t maskLOW;
volatile uint32_t *shadowinout;
};
#else #else
struct FASTPIN { typedef uint8_t portreg_t;
volatile uint8_t *inout;
uint8_t maskHIGH;
uint8_t maskLOW;
volatile uint8_t *shadowinout;
};
#endif #endif
struct FASTPIN {
volatile portreg_t *inout;
portreg_t maskHIGH;
portreg_t maskLOW;
volatile portreg_t *shadowinout;
};
// The port registers that are shadowing
// the real port registers. These are
// defined in Motordriver.cpp
extern volatile portreg_t fakePORTA;
extern volatile portreg_t fakePORTB;
extern volatile portreg_t fakePORTC;
enum class POWERMODE : byte { OFF, ON, OVERLOAD }; enum class POWERMODE : byte { OFF, ON, OVERLOAD };

View File

@ -86,13 +86,6 @@ void TrackManager::addTrack(byte t, MotorDriver* driver) {
} }
} }
// The port registers that are shadowing
// the real port registers. These are
// defined in Motordriver.cpp
extern byte fakePORTA;
extern byte fakePORTB;
extern byte fakePORTC;
// setDCCSignal(), called from interrupt context // setDCCSignal(), called from interrupt context
// does assume ports are shadowed if they can be // does assume ports are shadowed if they can be
void TrackManager::setDCCSignal( bool on) { void TrackManager::setDCCSignal( bool on) {