20 inline byte byteNumber(byte inFunctionNumber) {
return inFunctionNumber / 8; }
21 inline byte bitNumber(byte inFunctionNumber) {
return inFunctionNumber % 8; }
34 void activate(byte inFunctionNumber);
45 #ifdef DCCPP_DEBUG_MODE 49 void printActivated();
60 static bool programMode;
61 static bool panicStopped;
63 static bool setThrottle(
volatile RegisterList *inReg,
int nReg,
int inLocoId,
int inStepsNumber,
int inNewSpeed,
bool inForward);
64 static int readCv(
volatile RegisterList *inReg,
int inLocoId, byte inCvId);
65 static void writeCv(
volatile RegisterList *inReg,
int inLocoId,
int inCvId, byte inCvValue);
84 static void beginMain(uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor);
91 static void beginProg(uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor);
95 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); }
98 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); }
102 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); }
105 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); }
112 static void beginEthernet(uint8_t *inMac, uint8_t *inIp, EthernetProtocol inProtocol = EthernetProtocol::TCP);
155 static inline bool setSpeedMain(
int nReg,
int inLocoId,
int inStepsNumber,
int inNewSpeed,
bool inForward) {
return setThrottle(&(mainRegs), nReg, inLocoId, inStepsNumber, inNewSpeed, inForward); }
161 static inline int readCvMain(
int inLocoId, byte inCvId) {
return readCv(&(mainRegs), inLocoId, inCvId); }
167 static inline void writeCvMain(
int inLocoId,
int inCvId, byte inValue) { writeCv(&(mainRegs), inLocoId, inCvId, inValue); }
184 static inline bool setSpeedProg(
int nReg,
int inLocoId,
int inStepsNumber,
int inNewSpeed,
bool inForward) {
return setThrottle(&(progRegs), nReg, inLocoId, inStepsNumber, inNewSpeed, inForward); }
190 static inline int readCvProg(
int inLocoId, byte inCvId) {
return readCv(&(progRegs), inLocoId, inCvId); }
196 static inline void writeCvProg(
int inLocoId,
int inCvId, byte inValue) { writeCv(&(progRegs), inLocoId, inCvId, inValue); }
211 static void setAccessory(
int inAddress, byte inSubAddress, byte inActivate);
213 #ifdef DCCPP_PRINT_DCCPP 217 static void showConfiguration();
static int readCvProg(int inLocoId, byte inCvId)
static bool setSpeedProg(int nReg, int inLocoId, int inStepsNumber, int inNewSpeed, bool inForward)
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 void setFunctionsProg(int nReg, int inLocoId, FunctionsState inStates)
static float getCurrentProg()
static float getCurrentMain()
static void writeCvProg(int inLocoId, int inCvId, byte inValue)
static void setCurrentSampleMaxMain(float inMax)
static void panicStop(bool inStop)
static void beginEthernet(uint8_t *inMac, uint8_t *inIp, EthernetProtocol inProtocol = EthernetProtocol::TCP)
static void beginProgMotorShield()
static void beginProg(uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor)
static void setFunctionsMain(int nReg, int inLocoId, const FunctionsState &inStates)
static void beginMainPololu()
static void beginMainMotorShield()
static void beginProgPololu()
bool isActivated(byte inFunctionNumber)
void inactivate(byte inFunctionNumber)
static void setCurrentSampleMaxProg(float inMax)
void activate(byte inFunctionNumber)
static void setAccessory(int inAddress, byte inSubAddress, byte inActivate)
static void beginMain(uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor)