-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathButtonMgr.h
52 lines (41 loc) · 1.14 KB
/
ButtonMgr.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
// ButtonMgr.h
#ifndef _BUTTONMGR_h
#define _BUTTONMGR_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
// Define modes for button management
#define MODE_RUN 0
#define MODE_PENDING 1
#define MODE_SETUP 2
// Define Setup Modes
#define SETUP_NONE 0
#define SETUP_HOUR 1
#define SETUP_MINUTE 2
#define SETUP_MONTH 3
#define SETUP_DAY 4
#define SETUP_YEAR 5
//#define SETUP_COLOR 6
const int setupArraySize = 6;
class ButtonMgrClass
{
public:
ButtonMgrClass(int, int, int);
int getModeButtonState();
int getSetupButtonState();
int getOpMode() { return currentOpMode; }
int setOpMode(int mode) { return currentOpMode = mode; }
int getSetupMode() {return currentSetupMode;}
int setSetupMode(int mode) { return currentSetupMode = mode; }
int setCounter() { return milCounter = 0; }
int modeBtnLongPress();
int checkClockSet();
void runClockSet(int);
private:
int modeButtonState, setButtonState, currentOpMode, milCounter, currentSetupMode;
int modePin, setPin, ledPin;
int setupModeState[setupArraySize] = { SETUP_HOUR, SETUP_MINUTE, SETUP_MONTH, SETUP_DAY, SETUP_YEAR };
};
#endif