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:
parent
4833eaac65
commit
9a98d10a86
|
@ -27,9 +27,9 @@
|
||||||
|
|
||||||
bool MotorDriver::commonFaultPin=false;
|
bool MotorDriver::commonFaultPin=false;
|
||||||
|
|
||||||
volatile portreg_t fakePORTA;
|
volatile portreg_t shadowPORTA;
|
||||||
volatile portreg_t fakePORTB;
|
volatile portreg_t shadowPORTB;
|
||||||
volatile portreg_t fakePORTC;
|
volatile portreg_t shadowPORTC;
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -44,17 +44,17 @@ MotorDriver::MotorDriver(VPIN power_pin, byte signal_pin, byte signal_pin2, int8
|
||||||
if (HAVE_PORTA(fastSignalPin.inout == &PORTA)) {
|
if (HAVE_PORTA(fastSignalPin.inout == &PORTA)) {
|
||||||
DIAG(F("Found PORTA pin %d"),signalPin);
|
DIAG(F("Found PORTA pin %d"),signalPin);
|
||||||
fastSignalPin.shadowinout = fastSignalPin.inout;
|
fastSignalPin.shadowinout = fastSignalPin.inout;
|
||||||
fastSignalPin.inout = &fakePORTA;
|
fastSignalPin.inout = &shadowPORTA;
|
||||||
}
|
}
|
||||||
if (HAVE_PORTB(fastSignalPin.inout == &PORTB)) {
|
if (HAVE_PORTB(fastSignalPin.inout == &PORTB)) {
|
||||||
DIAG(F("Found PORTB pin %d"),signalPin);
|
DIAG(F("Found PORTB pin %d"),signalPin);
|
||||||
fastSignalPin.shadowinout = fastSignalPin.inout;
|
fastSignalPin.shadowinout = fastSignalPin.inout;
|
||||||
fastSignalPin.inout = &fakePORTB;
|
fastSignalPin.inout = &shadowPORTB;
|
||||||
}
|
}
|
||||||
if (HAVE_PORTC(fastSignalPin.inout == &PORTC)) {
|
if (HAVE_PORTC(fastSignalPin.inout == &PORTC)) {
|
||||||
DIAG(F("Found PORTC pin %d"),signalPin);
|
DIAG(F("Found PORTC pin %d"),signalPin);
|
||||||
fastSignalPin.shadowinout = fastSignalPin.inout;
|
fastSignalPin.shadowinout = fastSignalPin.inout;
|
||||||
fastSignalPin.inout = &fakePORTC;
|
fastSignalPin.inout = &shadowPORTC;
|
||||||
}
|
}
|
||||||
|
|
||||||
signalPin2=signal_pin2;
|
signalPin2=signal_pin2;
|
||||||
|
@ -187,21 +187,21 @@ void MotorDriver::setDCSignal(byte speedcode) {
|
||||||
if (fastSignalPin.shadowinout != NULL) {
|
if (fastSignalPin.shadowinout != NULL) {
|
||||||
if (HAVE_PORTA(fastSignalPin.shadowinout == &PORTA)) {
|
if (HAVE_PORTA(fastSignalPin.shadowinout == &PORTA)) {
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
HAVE_PORTA(fakePORTA=PORTA);
|
HAVE_PORTA(shadowPORTA=PORTA);
|
||||||
setSignal(tDir);
|
setSignal(tDir);
|
||||||
HAVE_PORTA(PORTA=fakePORTA);
|
HAVE_PORTA(PORTA=shadowPORTA);
|
||||||
interrupts();
|
interrupts();
|
||||||
} else if (HAVE_PORTB(fastSignalPin.shadowinout == &PORTB)) {
|
} else if (HAVE_PORTB(fastSignalPin.shadowinout == &PORTB)) {
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
HAVE_PORTB(fakePORTB=PORTB);
|
HAVE_PORTB(shadowPORTB=PORTB);
|
||||||
setSignal(tDir);
|
setSignal(tDir);
|
||||||
HAVE_PORTB(PORTB=fakePORTB);
|
HAVE_PORTB(PORTB=shadowPORTB);
|
||||||
interrupts();
|
interrupts();
|
||||||
} else if (HAVE_PORTC(fastSignalPin.shadowinout == &PORTC)) {
|
} else if (HAVE_PORTC(fastSignalPin.shadowinout == &PORTC)) {
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
HAVE_PORTC(fakePORTC=PORTC);
|
HAVE_PORTC(shadowPORTC=PORTC);
|
||||||
setSignal(tDir);
|
setSignal(tDir);
|
||||||
HAVE_PORTC(PORTC=fakePORTC);
|
HAVE_PORTC(PORTC=shadowPORTC);
|
||||||
interrupts();
|
interrupts();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -76,9 +76,9 @@ struct FASTPIN {
|
||||||
// The port registers that are shadowing
|
// The port registers that are shadowing
|
||||||
// the real port registers. These are
|
// the real port registers. These are
|
||||||
// defined in Motordriver.cpp
|
// defined in Motordriver.cpp
|
||||||
extern volatile portreg_t fakePORTA;
|
extern volatile portreg_t shadowPORTA;
|
||||||
extern volatile portreg_t fakePORTB;
|
extern volatile portreg_t shadowPORTB;
|
||||||
extern volatile portreg_t fakePORTC;
|
extern volatile portreg_t shadowPORTC;
|
||||||
|
|
||||||
enum class POWERMODE : byte { OFF, ON, OVERLOAD };
|
enum class POWERMODE : byte { OFF, ON, OVERLOAD };
|
||||||
|
|
||||||
|
|
|
@ -89,13 +89,13 @@ void TrackManager::addTrack(byte t, MotorDriver* driver) {
|
||||||
// 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) {
|
||||||
HAVE_PORTA(fakePORTA=PORTA);
|
HAVE_PORTA(shadowPORTA=PORTA);
|
||||||
HAVE_PORTB(fakePORTB=PORTB);
|
HAVE_PORTB(shadowPORTB=PORTB);
|
||||||
HAVE_PORTC(fakePORTC=PORTC);
|
HAVE_PORTC(shadowPORTC=PORTC);
|
||||||
APPLY_BY_MODE(TRACK_MODE_MAIN,setSignal(on));
|
APPLY_BY_MODE(TRACK_MODE_MAIN,setSignal(on));
|
||||||
HAVE_PORTA(PORTA=fakePORTA);
|
HAVE_PORTA(PORTA=shadowPORTA);
|
||||||
HAVE_PORTB(PORTB=fakePORTB);
|
HAVE_PORTB(PORTB=shadowPORTB);
|
||||||
HAVE_PORTC(PORTC=fakePORTC);
|
HAVE_PORTC(PORTC=shadowPORTC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackManager::setCutout( bool on) {
|
void TrackManager::setCutout( bool on) {
|
||||||
|
@ -107,13 +107,13 @@ void TrackManager::setCutout( bool on) {
|
||||||
// setPROGSignal(), called from interrupt context
|
// setPROGSignal(), called from interrupt context
|
||||||
// does assume ports are shadowed if they can be
|
// does assume ports are shadowed if they can be
|
||||||
void TrackManager::setPROGSignal( bool on) {
|
void TrackManager::setPROGSignal( bool on) {
|
||||||
HAVE_PORTA(fakePORTA=PORTA);
|
HAVE_PORTA(shadowPORTA=PORTA);
|
||||||
HAVE_PORTB(fakePORTB=PORTB);
|
HAVE_PORTB(shadowPORTB=PORTB);
|
||||||
HAVE_PORTC(fakePORTC=PORTC);
|
HAVE_PORTC(shadowPORTC=PORTC);
|
||||||
APPLY_BY_MODE(TRACK_MODE_PROG,setSignal(on));
|
APPLY_BY_MODE(TRACK_MODE_PROG,setSignal(on));
|
||||||
HAVE_PORTA(PORTA=fakePORTA);
|
HAVE_PORTA(PORTA=shadowPORTA);
|
||||||
HAVE_PORTB(PORTB=fakePORTB);
|
HAVE_PORTB(PORTB=shadowPORTB);
|
||||||
HAVE_PORTC(PORTC=fakePORTC);
|
HAVE_PORTC(PORTC=shadowPORTC);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setDCSignal(), called from normal context
|
// setDCSignal(), called from normal context
|
||||||
|
|
Loading…
Reference in New Issue
Block a user