-
Notifications
You must be signed in to change notification settings - Fork 0
/
TCTurnout.h
87 lines (65 loc) · 1.45 KB
/
TCTurnout.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// TCTurnout.h
#ifndef _TCTURNOUT_h
#define _TCTURNOUT_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
#include "TCCommon.h"
#include "TCModule.h"
class CModule_Turnout : public CModule
{
public:
CModule_Turnout(
);
virtual void
Setup(
void);
virtual void
Update(
uint32_t inDeltaTimeUS);
void
SetTurnoutDirection(
uint16_t inTurnoutID,
uint8_t inDirection);
void
ControlSwitchTouchedTurnoutID(
uint16_t inTurnoutID,
bool inTouched,
bool inBroadcast);
bool
TableRead(
int8_t inSrcNode,
SMsg_Table const& inProgram);
bool
TableWrite(
int8_t inSrcNode,
SMsg_Table const& inProgram);
bool
TableUpdate(
int8_t inSrcNode,
SMsg_Table const& inProgram);
private:
struct STurnoutIDToLEDNumList
{
uint8_t count;
uint8_t straightNumList[eMaxLEDsPerTurnout];
uint8_t turnNumList[eMaxLEDsPerTurnout];
};
void
ActivateTurnout(
uint8_t inTurnoutID,
uint8_t inDirection);
STrackTurnoutConfig turnoutConfigArray[eMaxTrackTurnoutCount];
STrackTurnoutLEDMapConfig turnoutLEDMapConfigArray[eMaxTrackTurnoutCount];
uint8_t turnoutDirectionArray[eMaxTrackTurnoutCount];
uint16_t turnoutConfigOffset;
uint16_t turnoutDirectionOffset;
uint16_t turnouLEDMapOffset;
STurnoutIDToLEDNumList turnoutIDToLEDNumMap[eMaxTurnoutID];
uint8_t turnoutIDToTableIndexMap[eMaxTurnoutID];
uint8_t turnoutTransmitIndex;
};
extern CModule_Turnout gTurnout;
#endif