InputEvents
v1.6.0
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
src
InputEvents.h
Go to the documentation of this file.
1
11
#ifndef INPUT_EVENTS_H
12
#define INPUT_EVENTS_H
13
14
#include <Arduino.h>
15
16
#ifndef FUNCTIONAL_SUPPORTED
17
#if defined(__has_include)
// Check if __has_include is supported
18
#if __has_include(<functional>)
19
#define FUNCTIONAL_SUPPORTED
20
#endif
21
#endif
22
#endif
23
25
/*
26
* Some platforms stupidly use #define for DISABLED (ahem, espressif), so replace it with a constexpr variable
27
* Many thanks to @kfoltman https://github.com/kfoltman for the workaround.
28
*/
29
#ifdef DISABLED
30
constexpr
auto
ACTUAL_DISABLED_VALUE=
DISABLED
;
31
#undef DISABLED
32
constexpr
auto
DISABLED
=ACTUAL_DISABLED_VALUE;
33
#endif
35
36
41
//constexpr size_t NUM_EVENT_TYPE_ENUMS = 20;
42
46
enum class
InputEventType
: uint8_t {
47
NONE
,
48
ENABLED
,
49
DISABLED
,
50
IDLE
,
51
PRESSED
,
52
RELEASED
,
53
CLICKED
,
54
DOUBLE_CLICKED
,
55
MULTI_CLICKED
,
56
LONG_CLICKED
,
57
LONG_PRESS
,
58
CHANGED
,
59
CHANGED_PRESSED
,
60
CHANGED_RELEASED
,
61
CHANGED_X
,
62
CHANGED_Y
,
63
ON
,
64
OFF
,
65
DRAGGED
,
66
DRAGGED_RELEASED
,
67
COUNT
68
};
69
70
#endif
InputEventType
InputEventType
The size of the InputEventType enum.
Definition:
InputEvents.h:46
InputEventType::DISABLED
@ DISABLED
2 Fired by all imputs
InputEventType::DRAGGED_RELEASED
@ DRAGGED_RELEASED
19 Fired by EventTouchScreen
InputEventType::RELEASED
@ RELEASED
5 Fired by EventButton, EventEncoderButton and EventTouchScreen
InputEventType::CLICKED
@ CLICKED
6 Fired by EventButton, EventEncoderButton and EventTouchScreen
InputEventType::COUNT
@ COUNT
Not used - replaces NUM_EVENT_TYPE_ENUMS.
InputEventType::DRAGGED
@ DRAGGED
18 Fired by EventTouchScreen
InputEventType::PRESSED
@ PRESSED
4 Fired by EventButton, EventEncoderButton and EventTouchScreen
InputEventType::LONG_PRESS
@ LONG_PRESS
10 Fired by EventButton, EventEncoderButton and EventTouchScreen
InputEventType::CHANGED_Y
@ CHANGED_Y
15 Fired Bby EventJoystick
InputEventType::DOUBLE_CLICKED
@ DOUBLE_CLICKED
7 Fired by EventButton, EventEncoderButton and EventTouchScreen
InputEventType::LONG_CLICKED
@ LONG_CLICKED
9 Fired by EventButton, EventEncoderButton and EventTouchScreen
InputEventType::OFF
@ OFF
17 Fired by EventSwitch
InputEventType::ON
@ ON
16 Fired by EventSwitch
InputEventType::IDLE
@ IDLE
3 Fired by all imputs
InputEventType::CHANGED_X
@ CHANGED_X
14 Fired Bby EventJoystick
InputEventType::NONE
@ NONE
0 Used for initialising/testing
InputEventType::MULTI_CLICKED
@ MULTI_CLICKED
8 Fired by EventButton, EventEncoderButton and EventTouchScreen
InputEventType::CHANGED_RELEASED
@ CHANGED_RELEASED
13 Fired by EventEncoderButton
InputEventType::ENABLED
@ ENABLED
1 Fired by all imputs
InputEventType::CHANGED_PRESSED
@ CHANGED_PRESSED
12 Fired by EventEncoderButton
InputEventType::CHANGED
@ CHANGED
11 Fired by EventEncoder and EventAnalog
Generated by
1.9.4