-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathButtons.h
50 lines (40 loc) · 863 Bytes
/
Buttons.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
#ifndef buttons_h
#define buttons_h
// buttons/switches
// Interacts with the 15 (8 data, 7 control) push-buttons via
// daisy-chained 74HC165's
class Buttons
{
public:
enum tButtons
{
eBit0,
eBit1,
eBit2,
eBit3,
eBit4,
eBit5,
eBit6,
eBit7,
eInputClear,
eAddressDisplay,
eAddressSet,
eMemoryRead,
eMemoryStore,
eRunStart,
eRunStop,
eUnused
};
void Init();
bool GetButtons(word& State, word& NewPressed, bool deBounce);
bool IsPressed(word BtnState, int Btn);
bool GetButtonDown(word BtnState, int& Btn);
private:
word ShiftIn(int LatchPin, int DataPin, int ClockPin, int BitOrder);
static byte m_pMap[];
word m_wPrevState;
word m_wPrevReading;
unsigned long m_iTransitionTimeMS;
};
extern Buttons buttons;
#endif