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 <cstddef>
9#include <cstdint>
10
11namespace lampda {
12namespace logic {
14namespace inputs {
15
17namespace __private {
18
20{
21 bool isLongPress = false;
23 uint8_t clickCount;
24 bool isEndOfLongPress = false;
25};
26
27static constexpr size_t maxButtonEventStore =
28 15;
29
31bool pop_button_event(ButtonEvent& event);
32
35
38
39} // namespace __private
40
43void init(const bool wasPoweredByUserInterrupt);
44
46void loop();
47
50
53
55bool add_button_click_event(uint8_t clickCount);
57bool add_button_press_event(uint8_t clickCount, uint32_t pressDuration, bool isEndOfPress);
58
59} // namespace inputs
60} // namespace logic
61} // namespace lampda
62
63#endif
bool pop_button_event(ButtonEvent &event)
Pop the oldest button event. Thread safe. Return false if there is no event.
Definition: inputs.cpp:56
void clear_button_events()
Drop all stored button events. Thread safe.
Definition: inputs.cpp:71
static constexpr size_t maxButtonEventStore
this event count should be high enough to not miss clicks and ramp events
Definition: inputs.h:27
size_t get_button_event_count()
Return the number of stored button events. Thread safe.
Definition: inputs.cpp:65
bool is_button_usermode_enabled()
return true if custom user modes are enabled
Definition: inputs.cpp:689
void button_disable_usermode()
disable custom user modes
Definition: inputs.cpp:687
void loop()
Call often to handle button updates.
Definition: inputs.cpp:642
bool add_button_click_event(uint8_t clickCount)
Signal a button click event.
Definition: inputs.cpp:691
bool add_button_press_event(uint8_t clickCount, uint32_t pressDuration, bool isEndOfPress)
Signal a button press event.
Definition: inputs.cpp:699
void init(const bool wasPoweredByUserInterrupt)
Call once on system start.
Definition: inputs.cpp:635
Program scope.
Definition: control_fixed_modes.hpp:14
uint8_t clickCount
keep track of the number of clicks of the chain
Definition: inputs.h:23
bool isLongPress
indicates if this is a long press click
Definition: inputs.h:21
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