-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbutton.h
46 lines (39 loc) · 782 Bytes
/
button.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
/*
button.h
header file for button class
Stefan Seegel, [email protected]
feb 2011
http://opensource.org/licenses/gpl-license.php GNU Public License
*/
#ifndef button_h
#define button_h
#include "task.h"
#include "timer.h"
#include "hw.h"
#define DEBOUNCE_TIME 20 //ms
#define LONG_TIME 2000 //ms
#define LONG_COUNTER (LONG_TIME / DEBOUNCE_TIME)
//button messages
#define BTN_SHORT 0x01
#define BTN_LONG 0x11
#define BTN_UP 0x04
#define BTN_DOWN 0x02
#define BTN_UPDOWN_LONG 0x16
#define BTN_CONFIG 0x17
class Button: public Task
{
private:
uint8_t state;
uint8_t msg;
Timer timer;
bool firstrun;
uint8_t counter;
protected:
bool Execute(void);
public:
Button(void);
uint8_t Check(void);
void Shutdown(bool led);
};
extern Button button;
#endif