15 inline byte byteNumber(byte inFunctionNumber) {
return inFunctionNumber / 8; }
16 inline byte bitNumber(byte inFunctionNumber) {
return inFunctionNumber % 8; }
22 void activate(byte inFunctionNumber);
23 void inactivate(byte inFunctionNumber);
24 bool isActivated(byte inFunctionNumber);
26 #ifdef DCCPP_DEBUG_MODE 27 void printActivated();
37 bool setThrottle(
volatile RegisterList *inReg,
int nReg,
int inLocoId,
int inStepsNumber,
int inNewSpeed,
bool inToLeft);
38 int readCv(
volatile RegisterList *inReg,
int inLocoId, byte inCvId);
39 void writeCv(
volatile RegisterList *inReg,
int inLocoId,
int inCvId, byte inCvValue);
52 void beginMain(uint8_t OptionalDirectionMotor, uint8_t Dummy, uint8_t SignalEnablePin, uint8_t
CurrentMonitor);
53 void beginProg(uint8_t OptionalDirectionMotor, uint8_t Dummy, uint8_t SignalEnablePin, uint8_t CurrentMonitor);
55 inline void beginMainMotorShield() { this->beginMain(MOTOR_SHIELD_DIRECTION_MOTOR_CHANNEL_PIN_A, DCC_SIGNAL_PIN_MAIN, MOTOR_SHIELD_SIGNAL_ENABLE_PIN_MAIN, MOTOR_SHIELD_CURRENT_MONITOR_PIN_MAIN); }
56 inline void beginProgMotorShield() { this->beginMain(MOTOR_SHIELD_DIRECTION_MOTOR_CHANNEL_PIN_B, DCC_SIGNAL_PIN_PROG, MOTOR_SHIELD_SIGNAL_ENABLE_PIN_PROG, MOTOR_SHIELD_CURRENT_MONITOR_PIN_PROG); }
58 inline void beginMainPololu() { this->beginMain(POLOLU_DIRECTION_MOTOR_CHANNEL_PIN_A, DCC_SIGNAL_PIN_MAIN, POLOLU_SIGNAL_ENABLE_PIN_MAIN, POLOLU_CURRENT_MONITOR_PIN_MAIN); }
59 inline void beginProgPololu() { this->beginMain(POLOLU_DIRECTION_MOTOR_CHANNEL_PIN_B, DCC_SIGNAL_PIN_PROG, POLOLU_SIGNAL_ENABLE_PIN_PROG, POLOLU_CURRENT_MONITOR_PIN_PROG); }
61 void beginEthernet(uint8_t *inMac, uint8_t *inIp, EthernetProtocol inProtocol = EthernetProtocol::TCP);
66 void panicStop(
bool inStop);
69 inline void setCurrentSampleMaxMain(
float inMax) { this->mainMonitor.currentSampleMax = inMax; }
70 inline void setCurrentSampleMaxProg(
float inMax) { this->progMonitor.currentSampleMax = inMax; }
71 inline float getCurrentMain() {
return this->mainMonitor.pin == UNDEFINED_PIN ? 0 : mainMonitor.current; }
72 inline float getCurrentProg() {
return this->progMonitor.pin == UNDEFINED_PIN ? 0 : progMonitor.current; }
75 inline bool setSpeedMain(
int nReg,
int inLocoId,
int inStepsNumber,
int inNewSpeed,
bool inToLeft) {
return this->setThrottle(&(this->mainRegs), nReg, inLocoId, inStepsNumber, inNewSpeed, inToLeft); }
76 inline int readCvMain(
int inLocoId, byte inCvId) {
return this->readCv(&(this->mainRegs), inLocoId, inCvId); }
77 inline void writeCvMain(
int inLocoId,
int inCvId, byte inValue) { this->writeCv(&(this->mainRegs), inLocoId, inCvId, inValue); }
78 inline void setFunctionsMain(
int nReg,
int inLocoId,
FunctionsState inStates) { this->setFunctions(&(this->mainRegs), nReg, inLocoId, inStates); }
81 inline bool setSpeedProg(
int nReg,
int inLocoId,
int inStepsNumber,
int inNewSpeed,
bool inToLeft) {
return this->setThrottle(&(this->progRegs), nReg, inLocoId, inStepsNumber, inNewSpeed, inToLeft); }
82 inline int readCvProg(
int inLocoId, byte inCvId) {
return this->readCv(&(this->progRegs), inLocoId, inCvId); }
83 inline void writeCvProg(
int inLocoId,
int inCvId, byte inValue) { this->writeCv(&(this->progRegs), inLocoId, inCvId, inValue); }
84 inline void setFunctionsProg(
int nReg,
int inLocoId,
FunctionsState inStates) { this->setFunctions(&(this->progRegs), nReg, inLocoId, inStates); }
87 void setAccessory(
int inAddress, byte inSubAddress, byte inActivate);
89 #ifdef DCCPP_PRINT_DCCPP 90 static void showConfiguration();
96 #define DCCpp DCCppClass::DCCppInstance