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>
9
11
12namespace lampda {
13namespace logic {
15namespace inputs {
16
18namespace __private {
19
21{
22 bool isLongPress = false;
24 uint32_t clickCount;
25 bool isEndOfLongPress = false;
26};
27
28static constexpr size_t maxButtonEventStore =
29 15;
30
32
33} // namespace __private
34
37void init(const bool wasPoweredByUserInterrupt);
38
40void loop();
41
44
47
49bool add_button_click_event(uint32_t clickCount);
51bool add_button_press_event(uint32_t clickCount, uint32_t pressDuration, bool isEndOfPress);
52
53} // namespace inputs
54} // namespace logic
55} // namespace lampda
56
57#endif
static constexpr size_t maxButtonEventStore
this event count should be high enough to not miss clicks and ramp events
Definition: inputs.h:28
common::Queue< ButtonEvent, maxButtonEventStore > buttonEventQueue
button event asynchroneous queue
Definition: inputs.cpp:34
bool add_button_click_event(uint32_t clickCount)
Signal a button click event.
Definition: inputs.cpp:607
bool add_button_press_event(uint32_t clickCount, uint32_t pressDuration, bool isEndOfPress)
Signal a button press event.
Definition: inputs.cpp:615
bool is_button_usermode_enabled()
return true if custom user modes are enabled
Definition: inputs.cpp:605
void button_disable_usermode()
disable custom user modes
Definition: inputs.cpp:603
void loop()
Call often to handle button updates.
Definition: inputs.cpp:568
void init(const bool wasPoweredByUserInterrupt)
Call once on system start.
Definition: inputs.cpp:562
Program scope.
Definition: control_fixed_modes.hpp:12
Define a queue object with constant memory footprint.
Definition: queue.h:15
bool isLongPress
indicates if this is a long press click
Definition: inputs.h:22
uint32_t clickCount
keep track of the number of clicks of the chain
Definition: inputs.h:24
uint32_t longPressDuration
during a long press click, this is the press time. It goes to zero on release
Definition: inputs.h:23
bool isEndOfLongPress
indicates if this is the end call of a long press click
Definition: inputs.h:25