-
Notifications
You must be signed in to change notification settings - Fork 0
/
Input.h
41 lines (33 loc) · 810 Bytes
/
Input.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
#pragma once
#include "Config.h"
namespace hw
{
enum class ButtonId
{
SwitchPhase,
SwitchView,
SwitchPhaseLong,
SwitchViewLong,
SwitchOnOff,
SwitchOnOffLong
};
class Input
{
public:
explicit Input(void (*buttonPressed)(ButtonId));
virtual ~Input() = default;
void initialize();
void update();
private:
void checkSwitchPhase();
void checkSwitchView();
void checkSwitchOnOff();
void (*_buttonPressed)(ButtonId);
int _lastSwitchPhasePinValue = 1;
int _lastSwitchViewPinValue = 1;
int _lastSwitchOnOffPinValue = 1;
long switchPhasePressedTs = -1;
long switchViewPressedTs = -1;
long switchOnOffPressedTs = -1;
};
}