23 byte activeFlagsSent[4];
25 inline byte byteNumber(byte inFunctionNumber) {
return inFunctionNumber / 8; }
26 inline byte bitNumber(byte inFunctionNumber) {
return inFunctionNumber % 8; }
39 void activate(byte inFunctionNumber);
58 #ifdef DCCPP_DEBUG_MODE 62 void printActivated();
73 static bool programMode;
74 static bool panicStopped;
76 static bool setThrottle(
volatile RegisterList *inReg,
int nReg,
int inLocoId,
int inStepsNumber,
int inNewSpeed,
bool inForward);
77 static int readCv(
volatile RegisterList *inReg,
int inLocoId, byte inCvId);
78 static void writeCv(
volatile RegisterList *inReg,
int inLocoId,
int inCvId, byte inCvValue);
97 static void beginMain(uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor);
104 static void beginProg(uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor);
108 static inline void beginMainMotorShield() {
beginMain(MOTOR_SHIELD_DIRECTION_MOTOR_CHANNEL_PIN_A, DCC_SIGNAL_PIN_MAIN, MOTOR_SHIELD_SIGNAL_ENABLE_PIN_MAIN, MOTOR_SHIELD_CURRENT_MONITOR_PIN_MAIN); }
111 static inline void beginProgMotorShield() {
beginMain(MOTOR_SHIELD_DIRECTION_MOTOR_CHANNEL_PIN_B, DCC_SIGNAL_PIN_PROG, MOTOR_SHIELD_SIGNAL_ENABLE_PIN_PROG, MOTOR_SHIELD_CURRENT_MONITOR_PIN_PROG); }
115 static inline void beginMainPololu() {
beginMain(POLOLU_DIRECTION_MOTOR_CHANNEL_PIN_A, DCC_SIGNAL_PIN_MAIN, POLOLU_SIGNAL_ENABLE_PIN_MAIN, POLOLU_CURRENT_MONITOR_PIN_MAIN); }
118 static inline void beginProgPololu() {
beginMain(POLOLU_DIRECTION_MOTOR_CHANNEL_PIN_B, DCC_SIGNAL_PIN_PROG, POLOLU_SIGNAL_ENABLE_PIN_PROG, POLOLU_CURRENT_MONITOR_PIN_PROG); }
125 static void beginEthernet(uint8_t *inMac, uint8_t *inIp, EthernetProtocol inProtocol = EthernetProtocol::TCP);
168 static inline bool setSpeedMain(
int nReg,
int inLocoId,
int inStepsNumber,
int inNewSpeed,
bool inForward) {
return setThrottle(&(mainRegs), nReg, inLocoId, inStepsNumber, inNewSpeed, inForward); }
174 static inline int readCvMain(
int inLocoId, byte inCvId) {
return readCv(&(mainRegs), inLocoId, inCvId); }
180 static inline void writeCvMain(
int inLocoId,
int inCvId, byte inValue) { writeCv(&(mainRegs), inLocoId, inCvId, inValue); }
197 static inline bool setSpeedProg(
int nReg,
int inLocoId,
int inStepsNumber,
int inNewSpeed,
bool inForward) {
return setThrottle(&(progRegs), nReg, inLocoId, inStepsNumber, inNewSpeed, inForward); }
203 static inline int readCvProg(
int inLocoId, byte inCvId) {
return readCv(&(progRegs), inLocoId, inCvId); }
209 static inline void writeCvProg(
int inLocoId,
int inCvId, byte inValue) { writeCv(&(progRegs), inLocoId, inCvId, inValue); }
224 static void setAccessory(
int inAddress, byte inSubAddress, byte inActivate);
226 #ifdef DCCPP_PRINT_DCCPP 230 static void showConfiguration();
static void setAccessory(int inAddress, byte inSubAddress, byte inActivate)
static int readCvProg(int inLocoId, byte inCvId)
static void setFunctionsMain(int nReg, int inLocoId, FunctionsState &inStates)
static void writeCvMain(int inLocoId, int inCvId, byte inValue)
static int readCvMain(int inLocoId, byte inCvId)
static bool setSpeedMain(int nReg, int inLocoId, int inStepsNumber, int inNewSpeed, bool inForward)
static float getCurrentProg()
static void setCurrentSampleMaxProg(float inMax)
static void writeCvProg(int inLocoId, int inCvId, byte inValue)
static void setCurrentSampleMaxMain(float inMax)
static void panicStop(bool inStop)
static void beginProgPololu()
static void beginMainPololu()
static void beginProgMotorShield()
static void beginMainMotorShield()
static void beginProg(uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor)
static void beginMain(uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor)
bool isActivationChanged(byte inFunctionNumber)
bool isActivated(byte inFunctionNumber)
static float getCurrentMain()
void inactivate(byte inFunctionNumber)
void activate(byte inFunctionNumber)
static void setFunctionsProg(int nReg, int inLocoId, FunctionsState &inStates)
static bool setSpeedProg(int nReg, int inLocoId, int inStepsNumber, int inNewSpeed, bool inForward)
static void beginEthernet(uint8_t *inMac, uint8_t *inIp, EthernetProtocol inProtocol = EthernetProtocol::TCP)