1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 23:56:13 +01:00

rename fakePORT* to shadowPORT*

This commit is contained in:
Harald Barth 2022-06-13 23:18:10 +02:00
parent 4833eaac65
commit 9a98d10a86
3 changed files with 27 additions and 27 deletions

View File

@ -27,9 +27,9 @@
bool MotorDriver::commonFaultPin=false;
volatile portreg_t fakePORTA;
volatile portreg_t fakePORTB;
volatile portreg_t fakePORTC;
volatile portreg_t shadowPORTA;
volatile portreg_t shadowPORTB;
volatile portreg_t shadowPORTC;
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) {
@ -44,17 +44,17 @@ MotorDriver::MotorDriver(VPIN power_pin, byte signal_pin, byte signal_pin2, int8
if (HAVE_PORTA(fastSignalPin.inout == &PORTA)) {
DIAG(F("Found PORTA pin %d"),signalPin);
fastSignalPin.shadowinout = fastSignalPin.inout;
fastSignalPin.inout = &fakePORTA;
fastSignalPin.inout = &shadowPORTA;
}
if (HAVE_PORTB(fastSignalPin.inout == &PORTB)) {
DIAG(F("Found PORTB pin %d"),signalPin);
fastSignalPin.shadowinout = fastSignalPin.inout;
fastSignalPin.inout = &fakePORTB;
fastSignalPin.inout = &shadowPORTB;
}
if (HAVE_PORTC(fastSignalPin.inout == &PORTC)) {
DIAG(F("Found PORTC pin %d"),signalPin);
fastSignalPin.shadowinout = fastSignalPin.inout;
fastSignalPin.inout = &fakePORTC;
fastSignalPin.inout = &shadowPORTC;
}
signalPin2=signal_pin2;
@ -187,21 +187,21 @@ void MotorDriver::setDCSignal(byte speedcode) {
if (fastSignalPin.shadowinout != NULL) {
if (HAVE_PORTA(fastSignalPin.shadowinout == &PORTA)) {
noInterrupts();
HAVE_PORTA(fakePORTA=PORTA);
HAVE_PORTA(shadowPORTA=PORTA);
setSignal(tDir);
HAVE_PORTA(PORTA=fakePORTA);
HAVE_PORTA(PORTA=shadowPORTA);
interrupts();
} else if (HAVE_PORTB(fastSignalPin.shadowinout == &PORTB)) {
noInterrupts();
HAVE_PORTB(fakePORTB=PORTB);
HAVE_PORTB(shadowPORTB=PORTB);
setSignal(tDir);
HAVE_PORTB(PORTB=fakePORTB);
HAVE_PORTB(PORTB=shadowPORTB);
interrupts();
} else if (HAVE_PORTC(fastSignalPin.shadowinout == &PORTC)) {
noInterrupts();
HAVE_PORTC(fakePORTC=PORTC);
HAVE_PORTC(shadowPORTC=PORTC);
setSignal(tDir);
HAVE_PORTC(PORTC=fakePORTC);
HAVE_PORTC(PORTC=shadowPORTC);
interrupts();
}
} else {

View File

@ -76,9 +76,9 @@ struct FASTPIN {
// 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;
extern volatile portreg_t shadowPORTA;
extern volatile portreg_t shadowPORTB;
extern volatile portreg_t shadowPORTC;
enum class POWERMODE : byte { OFF, ON, OVERLOAD };

View File

@ -89,13 +89,13 @@ void TrackManager::addTrack(byte t, MotorDriver* driver) {
// setDCCSignal(), called from interrupt context
// does assume ports are shadowed if they can be
void TrackManager::setDCCSignal( bool on) {
HAVE_PORTA(fakePORTA=PORTA);
HAVE_PORTB(fakePORTB=PORTB);
HAVE_PORTC(fakePORTC=PORTC);
HAVE_PORTA(shadowPORTA=PORTA);
HAVE_PORTB(shadowPORTB=PORTB);
HAVE_PORTC(shadowPORTC=PORTC);
APPLY_BY_MODE(TRACK_MODE_MAIN,setSignal(on));
HAVE_PORTA(PORTA=fakePORTA);
HAVE_PORTB(PORTB=fakePORTB);
HAVE_PORTC(PORTC=fakePORTC);
HAVE_PORTA(PORTA=shadowPORTA);
HAVE_PORTB(PORTB=shadowPORTB);
HAVE_PORTC(PORTC=shadowPORTC);
}
void TrackManager::setCutout( bool on) {
@ -107,13 +107,13 @@ void TrackManager::setCutout( bool on) {
// setPROGSignal(), called from interrupt context
// does assume ports are shadowed if they can be
void TrackManager::setPROGSignal( bool on) {
HAVE_PORTA(fakePORTA=PORTA);
HAVE_PORTB(fakePORTB=PORTB);
HAVE_PORTC(fakePORTC=PORTC);
HAVE_PORTA(shadowPORTA=PORTA);
HAVE_PORTB(shadowPORTB=PORTB);
HAVE_PORTC(shadowPORTC=PORTC);
APPLY_BY_MODE(TRACK_MODE_PROG,setSignal(on));
HAVE_PORTA(PORTA=fakePORTA);
HAVE_PORTB(PORTB=fakePORTB);
HAVE_PORTC(PORTC=fakePORTC);
HAVE_PORTA(PORTA=shadowPORTA);
HAVE_PORTB(PORTB=shadowPORTB);
HAVE_PORTC(PORTC=shadowPORTC);
}
// setDCSignal(), called from normal context