-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTPL2.h
More file actions
49 lines (47 loc) · 1.47 KB
/
TPL2.h
File metadata and controls
49 lines (47 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class TPL2 {
public:
static void begin(
short _signalZeroPin, // arduino pin connected to first signal
short _signals // Number of signals (2 pins each)
);
static void loop();
TPL2(byte route);
~TPL2();
static void readLocoCallback(int cv);
private:
static int locateRouteStart(short _route);
static int progtrackLocoId;
static TPL2 * loopTask;
static TPL2 * pausingTask;
void delayMe(int millisecs);
void driveLoco(byte speedo);
bool readSensor(short id);
void skipIfBlock();
void setSignal(short num, bool go);
bool readLoco();
void showManual();
void showProg(bool progOn);
bool doManual();
void loop2();
static const short SECTION_FLAG = 0x01;
static const short SENSOR_FLAG = 0x02;
static const short SIGNAL_FLAG = 0x04;
static const short MAX_FLAGS=128;
static byte flags[MAX_FLAGS];
static byte sensorCount;
static bool manual_mode;
static bool manual_mode_flipflop;
static byte manualTurnoutNumber;
static int manualModeCounter;
static int signalZeroPin;
// Local variables
int progCounter; // Byte offset of next route opcode in ROUTES table
unsigned long delayStart; // Used by opcodes that must be recalled before completing
unsigned long waitAfter; // Used by OPCODE_AFTER
unsigned int delayTime;
int loco;
bool forward;
bool invert;
int speedo;
TPL2 *next; // loop chain
};