mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
multi click support including buzzer toggle
This commit is contained in:
parent
a93a0fecba
commit
ce31fd7c57
4 changed files with 89 additions and 7 deletions
|
|
@ -5,6 +5,8 @@
|
|||
#define BUTTON_EVENT_NONE 0
|
||||
#define BUTTON_EVENT_CLICK 1
|
||||
#define BUTTON_EVENT_LONG_PRESS 2
|
||||
#define BUTTON_EVENT_DOUBLE_CLICK 3
|
||||
#define BUTTON_EVENT_TRIPLE_CLICK 4
|
||||
|
||||
class MomentaryButton {
|
||||
int8_t _pin;
|
||||
|
|
@ -13,6 +15,10 @@ class MomentaryButton {
|
|||
int _long_millis;
|
||||
int _threshold; // analog mode
|
||||
unsigned long down_at;
|
||||
uint8_t _click_count;
|
||||
unsigned long _last_click_time;
|
||||
int _multi_click_window;
|
||||
bool _pending_click;
|
||||
|
||||
bool isPressed(int level) const;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue