InputEvents v1.6.0
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
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
30constexpr auto ACTUAL_DISABLED_VALUE=DISABLED;
31#undef DISABLED
32constexpr auto DISABLED=ACTUAL_DISABLED_VALUE;
33#endif
35
36
41//constexpr size_t NUM_EVENT_TYPE_ENUMS = 20;
42
46enum class InputEventType : uint8_t {
47 NONE,
48 ENABLED,
49 DISABLED,
50 IDLE,
51 PRESSED,
52 RELEASED,
53 CLICKED,
58 CHANGED,
61 CHANGED_X,
62 CHANGED_Y,
63 ON,
64 OFF,
65 DRAGGED,
67 COUNT
68};
69
70#endif
InputEventType
The size of the InputEventType enum.
Definition: InputEvents.h:46
@ DISABLED
2 Fired by all imputs
@ DRAGGED_RELEASED
19 Fired by EventTouchScreen
@ RELEASED
5 Fired by EventButton, EventEncoderButton and EventTouchScreen
@ CLICKED
6 Fired by EventButton, EventEncoderButton and EventTouchScreen
@ COUNT
Not used - replaces NUM_EVENT_TYPE_ENUMS.
@ DRAGGED
18 Fired by EventTouchScreen
@ PRESSED
4 Fired by EventButton, EventEncoderButton and EventTouchScreen
@ LONG_PRESS
10 Fired by EventButton, EventEncoderButton and EventTouchScreen
@ CHANGED_Y
15 Fired Bby EventJoystick
@ DOUBLE_CLICKED
7 Fired by EventButton, EventEncoderButton and EventTouchScreen
@ LONG_CLICKED
9 Fired by EventButton, EventEncoderButton and EventTouchScreen
@ OFF
17 Fired by EventSwitch
@ ON
16 Fired by EventSwitch
@ IDLE
3 Fired by all imputs
@ CHANGED_X
14 Fired Bby EventJoystick
@ NONE
0 Used for initialising/testing
@ MULTI_CLICKED
8 Fired by EventButton, EventEncoderButton and EventTouchScreen
@ CHANGED_RELEASED
13 Fired by EventEncoderButton
@ ENABLED
1 Fired by all imputs
@ CHANGED_PRESSED
12 Fired by EventEncoderButton
@ CHANGED
11 Fired by EventEncoder and EventAnalog