#include "DCCpp.hpp"
Static Public Member Functions | |
static void | begin () |
static void | beginMain (uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor) |
static void | beginProg (uint8_t inOptionalDirectionMotor, uint8_t inSignalPin, uint8_t inSignalEnablePin, uint8_t inCurrentMonitor) |
static void | beginMainMotorShield () |
static void | beginProgMotorShield () |
static void | beginMainPololu () |
static void | beginProgPololu () |
static bool | IsMainTrack (volatile RegisterList *apRegs) |
static void | loop () |
static void | panicStop (bool inStop) |
static void | powerOn () |
static void | powerOff () |
static void | setCurrentSampleMaxMain (float inMax) |
static void | setCurrentSampleMaxProg (float inMax) |
static float | getCurrentMain () |
static float | getCurrentProg () |
static bool | setSpeedMain (int nReg, int inLocoId, int inStepsNumber, int inNewSpeed, bool inForward) |
static int | identifyLocoIdMain () |
static int | readCvMain (int inCvId, int callBack = 100, int callBackSub = 200) |
static void | writeCvMain (int inCvId, byte inValue, int callBack = 100, int callBackSub = 200) |
static void | setFunctionsMain (int nReg, int inLocoId, FunctionsState &inStates) |
static bool | setSpeedProg (int nReg, int inLocoId, int inStepsNumber, int inNewSpeed, bool inForward) |
static int | identifyLocoIdProg () |
static int | readCvProg (int inCvId, int callBack = 100, int callBackSub = 200) |
static void | writeCvProg (int inCvId, byte inValue, int callBack = 100, int callBackSub = 200) |
static void | setFunctionsProg (int nReg, int inLocoId, FunctionsState &inStates) |
static void | setAccessory (int inAddress, byte inSubAddress, byte inActivate) |
Static Public Attributes | |
static volatile RegisterList | mainRegs |
static volatile RegisterList | progRegs |
static CurrentMonitor | mainMonitor |
static CurrentMonitor | progMonitor |
This is the main class of the library. All data and functions are static. There is no needs to instantiate this class.
|
static |
Initializes the main track.
inOptionalDirectionMotor | Pin for the rerouting of shields direction pin, set it to UNDEFINED_PIN if not used. |
inSignalPin | Pin for the signal pin, the one driven by an interruption, set it to UNDEFINED_PIN if not used (but the line will be always down...). |
inSignalEnablePin | Pin for the enable/PWM pin, set it to UNDEFINED_PIN if not used. |
inCurrentMonitor | Pin for the current monitor analog pin, set it to UNDEFINED_PIN if not used. |
|
inlinestatic |
|
inlinestatic |
|
static |
Initializes the programming track.
inOptionalDirectionMotor | Pin for the rerouting of shields direction pin, set it to UNDEFINED_PIN if not used. |
inSignalPin | Pin for the signal pin, the one driven by an interruption, set it to UNDEFINED_PIN if not used (but the line will be always down...). |
inSignalEnablePin | Pin for the enable/PWM pin, set it to UNDEFINED_PIN if not used. |
inCurrentMonitor | Pin for the current monitor analog pin, set it to UNDEFINED_PIN if not used. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Checks if the given RegisterList is from the main track or not.
apRegs | RegisterList to check. |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
Try to read a CV from a decoder on the main track. Be sure there is only one loco on the track before calling this function !
inCvId | CV id from 0 to 255. |
callBack | an arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs that call this function. Default 100. |
callBackSub | a second arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs (e.g. DCC++ Interface) that call this function. Default 200 |
|
inlinestatic |
Try to read a CV from a decoder on the programming track. Be sure there is only one loco on the track before calling this function !
inCvId | CV id from 0 to 255. |
callBack | an arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs that call this function. Default 100. |
callBackSub | a second arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs (e.g. DCC++ Interface) that call this function. Default 200 |
|
static |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Set the functions states of the given decoder on the main track.
nReg | Register number. Avoid register 0, used for one shot commands like accessories or CV programming. |
inLocoId | Decoder address in short or long format. |
inStates | FunctionsState class with the wanted new status. |
|
inlinestatic |
Set the functions states of the given decoder on the programming track.
nReg | Register number. Avoid register 0, used for one shot commands like accessories or CV programming. |
inLocoId | Decoder address in short or long format. |
inStates | FunctionsState class with the wanted new status. |
|
inlinestatic |
For the given decoder id, set the speed and the direction on the main track.
nReg | Register number. Avoid register 0, used for one shot commands like accessories or CV programming. |
inLocoId | Decoder address in short or long format. |
inStepsNumber | According to the decoder configuration, set it to 14, 28 or 128 . |
inNewSpeed | Speed of the loco, between 2 and the steps number - 1 (13, 27 or 127). 0 means normal complete stop. 1 means emergency stop. |
inForward | True means forward move, false means backward. |
|
inlinestatic |
For the given decoder id, set the speed and the direction on the programming track.
nReg | Register number. Avoid register 0, used for one shot commands like accessories or CV programming. |
inLocoId | Decoder address in short or long format. |
inStepsNumber | According to the decoder configuration, set it to 14, 28 or 128 . |
inNewSpeed | Speed of the loco, between 2 and the steps number - 1 (13, 27 or 127). 0 means normal complete stop. 1 means emergency stop. |
inForward | True means forward move, false means backward. |
|
inlinestatic |
Write the given CV on the main track. Be sure there is only one loco on the track before calling this function !
inCvId | CV id from 0 to 255. |
inValue | CV new value from 0 to 255. |
callBack | an arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs that call this function. Default 100. |
callBackSub | a second arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs (e.g. DCC++ Interface) that call this function. Default 200 |
|
inlinestatic |
Write the given CV on the programming track.
inCvId | CV id from 0 to 255. |
inValue | CV new value from 0 to 255. |
callBack | an arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs that call this function. Default 100. |
callBackSub | a second arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs (e.g. DCC++ Interface) that call this function. Default 200 |