Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
inputs.h
Go to the documentation of this file.
1
5#ifndef INPUTS_H
6#define INPUTS_H
7
8#include <cstdint>
10
11namespace lampda {
12namespace logic {
14namespace inputs {
15
17namespace __private {
18
20{
21 bool isLongPress = false;
23 uint32_t clickCount;
24 bool isEndOfLongPress = false;
25};
26
27static constexpr size_t maxButtonEventStore =
28 15;
29
31
32} // namespace __private
33
36void init(const bool wasPoweredByUserInterrupt);
37
39void loop();
40
43
46
48bool add_button_click_event(uint32_t clickCount);
50bool add_button_press_event(uint32_t clickCount, uint32_t pressDuration, bool isEndOfPress);
51
52} // namespace inputs
53} // namespace logic
54} // namespace lampda
55
56#endif
static constexpr size_t maxButtonEventStore
this event count should be high enough to not miss clicks and ramp events
Definition: inputs.h:27
utils::Queue< ButtonEvent, maxButtonEventStore > buttonEventQueue
button event asynchroneous queue
Definition: inputs.cpp:33
bool add_button_click_event(uint32_t clickCount)
Signal a button click event.
Definition: inputs.cpp:606
bool add_button_press_event(uint32_t clickCount, uint32_t pressDuration, bool isEndOfPress)
Signal a button press event.
Definition: inputs.cpp:614
bool is_button_usermode_enabled()
return true if custom user modes are enabled
Definition: inputs.cpp:604
void button_disable_usermode()
disable custom user modes
Definition: inputs.cpp:602
void loop()
Call often to handle button updates.
Definition: inputs.cpp:567
void init(const bool wasPoweredByUserInterrupt)
Call once on system start.
Definition: inputs.cpp:561
Program scope.
Definition: control_fixed_modes.hpp:12
Define a queue object with constant memory footprint.
bool isLongPress
indicates if this is a long press click
Definition: inputs.h:21
uint32_t clickCount
keep track of the number of clicks of the chain
Definition: inputs.h:23
uint32_t longPressDuration
during a long press click, this is the press time. It goes to zero on release
Definition: inputs.h:22
bool isEndOfLongPress
indicates if this is the end call of a long press click
Definition: inputs.h:24
Definition: queue.h:16