-
Notifications
You must be signed in to change notification settings - Fork 6
/
Interface.h
65 lines (44 loc) · 1.12 KB
/
Interface.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
#pragma once
#include <Bounce.h>
class DIAL
{
int m_data_pin;
int m_current_value;
public:
DIAL( int data_pin );
bool update();
float value() const;
};
//////////////////////////////////////
class BUTTON
{
int16_t m_data_pin;
int16_t m_is_toggle : 1;
int16_t m_prev_is_active : 1;
int16_t m_is_active : 1;
int16_t m_down_time_valid : 1;
int32_t m_down_time_stamp;
int32_t m_down_time_curr;
Bounce m_bounce;
public:
BUTTON( int data_pin, bool is_toggle );
bool active() const;
bool single_click() const;
int32_t down_time_ms() const;
void setup();
void update( int32_t time_ms );
};
//////////////////////////////////////
class LED
{
int m_data_pin;
int m_brightness;
bool m_is_active;
public:
LED(); // to allow for arrays
LED( int data_pin );
void set_active( bool active );
void set_brightness( float brightness );
void setup();
void update();
};