#include "Turnout.h"
Public Member Functions | |
void | begin (int id, int add, int subAdd) |
void | set (int id, int add, int subAdd) |
void | activate (int s=1) |
void | inactivate () |
bool | isActivated () |
Static Public Member Functions | |
static Turnout * | get (int id) |
static void | remove (int id) |
static int | count () |
static void | show () |
static void | load () |
static void | store () |
static bool | parse (char *c) |
static Turnout * | create (int id, int add, int subAdd) |
Public Attributes | |
struct TurnoutData | data |
Turnout * | nextTurnout |
int | eepromPos |
Static Public Attributes | |
static Turnout * | firstTurnout = NULL |
DCC++ BASE STATION can keep track of the direction of any turnout that is controlled by a DCC stationary accessory decoder.
If the TextCommand is used, all turnouts, as well as any other DCC accessories connected in this fashion, can always be operated using the DCC BASE STATION Turnout command.
When controlled as such, the Arduino updates and stores the direction of each Turnout in EEPROM so that it is retained even without power. A list of the current directions of each Turnout in the form <H ID THROW> is generated by this sketch whenever the <s> status command is invoked. This provides an efficient way of initializing the directions of any Turnouts being monitored or controlled by a separate interface or GUI program.
Once all turnouts have been properly defined, use the <E> command to store their definitions to EEPROM. If you later make edits/additions/deletions to the turnout definitions, you must invoke the <E> command if you want those new definitions updated in the EEPROM. You can also clear everything stored in the EEPROM by invoking the <e> command.
Without TextCommand, this is a classic C++ usage. An instance of the structure is created by the user, and functions like begin() and activate() can be applied on this instance. load() and store() of the class can still be used (if USE_EEPROM is activated).
void Turnout::activate | ( | int | s = 1 | ) |
Change the activation state of the turnout.
s | new state : 0 for off, 1 for on. Default is 1. |
Definition at line 73 of file Turnout.cpp.
void Turnout::begin | ( | int | id, |
int | add, | ||
int | subAdd | ||
) |
Initialize the turnout created by regular C++ instantiation.
id | The numeric ID (0-32767) of the sensor. |
add | The primary address of the decoder controlling this turnout (0-511). |
subAdd | The sub-address of the decoder controlling this turnout (0-3). |
Definition at line 34 of file Turnout.cpp.
|
static |
Get the total number of turnouts.
Definition at line 141 of file Turnout.cpp.
|
static |
Creates a new turnout in the list..
id | The numeric ID (0-32767) of the sensor. |
add | The primary address of the decoder controlling this turnout (0-511). |
subAdd | The sub-address of the decoder controlling this turnout (0-3). |
Definition at line 259 of file Turnout.cpp.
|
static |
Get a particular turnout.
id | The numeric ID (0-32767) of the turnout. |
Definition at line 100 of file Turnout.cpp.
|
inline |
|
inline |
|
static |
Load the content of all turnouts from EEPROM.
Definition at line 152 of file Turnout.cpp.
|
static |
Do command according to the given command string.
c | string to interpret... See syntax in class description. |
Definition at line 206 of file Turnout.cpp.
|
static |
Removes a particular turnout.
id | The numeric ID (0-32767) of the turnout. |
Definition at line 108 of file Turnout.cpp.
void Turnout::set | ( | int | id, |
int | add, | ||
int | subAdd | ||
) |
Force the turnout values created by command line.
id | The numeric ID (0-32767) of the sensor. |
add | The primary address of the decoder controlling this turnout (0-511). |
subAdd | The sub-address of the decoder controlling this turnout (0-3). |
Definition at line 64 of file Turnout.cpp.
|
static |
Show the content of all the turnouts.
Definition at line 284 of file Turnout.cpp.
|
static |
Store the content of all turnouts in EEPROM.
Definition at line 181 of file Turnout.cpp.
struct TurnoutData Turnout::data |
int Turnout::eepromPos |
|
static |
Turnout* Turnout::nextTurnout |