Lamp-Da
0.1
A compact lantern project
Loading...
Searching...
No Matches
src
system
logic
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
11
namespace
lampda
{
12
namespace
logic {
14
namespace
inputs {
15
17
namespace
__private {
18
19
struct
ButtonEvent
20
{
21
bool
isLongPress
=
false
;
22
uint32_t
longPressDuration
;
23
uint8_t
clickCount
;
24
bool
isEndOfLongPress
=
false
;
25
};
26
27
static
constexpr
size_t
maxButtonEventStore
=
28
15;
29
31
bool
pop_button_event
(
ButtonEvent
& event);
32
34
size_t
get_button_event_count
();
35
37
void
clear_button_events
();
38
39
}
// namespace __private
40
43
void
init
(
const
bool
wasPoweredByUserInterrupt);
44
46
void
loop
();
47
49
void
button_disable_usermode
();
50
52
bool
is_button_usermode_enabled
();
53
55
bool
add_button_click_event
(uint8_t clickCount);
57
bool
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
lampda::logic::inputs::__private::pop_button_event
bool pop_button_event(ButtonEvent &event)
Pop the oldest button event. Thread safe. Return false if there is no event.
Definition:
inputs.cpp:56
lampda::logic::inputs::__private::clear_button_events
void clear_button_events()
Drop all stored button events. Thread safe.
Definition:
inputs.cpp:71
lampda::logic::inputs::__private::maxButtonEventStore
static constexpr size_t maxButtonEventStore
this event count should be high enough to not miss clicks and ramp events
Definition:
inputs.h:27
lampda::logic::inputs::__private::get_button_event_count
size_t get_button_event_count()
Return the number of stored button events. Thread safe.
Definition:
inputs.cpp:65
lampda::logic::inputs::is_button_usermode_enabled
bool is_button_usermode_enabled()
return true if custom user modes are enabled
Definition:
inputs.cpp:689
lampda::logic::inputs::button_disable_usermode
void button_disable_usermode()
disable custom user modes
Definition:
inputs.cpp:687
lampda::logic::inputs::loop
void loop()
Call often to handle button updates.
Definition:
inputs.cpp:642
lampda::logic::inputs::add_button_click_event
bool add_button_click_event(uint8_t clickCount)
Signal a button click event.
Definition:
inputs.cpp:691
lampda::logic::inputs::add_button_press_event
bool add_button_press_event(uint8_t clickCount, uint32_t pressDuration, bool isEndOfPress)
Signal a button press event.
Definition:
inputs.cpp:699
lampda::logic::inputs::init
void init(const bool wasPoweredByUserInterrupt)
Call once on system start.
Definition:
inputs.cpp:635
lampda
Program scope.
Definition:
control_fixed_modes.hpp:14
lampda::logic::inputs::__private::ButtonEvent
Definition:
inputs.h:20
lampda::logic::inputs::__private::ButtonEvent::clickCount
uint8_t clickCount
keep track of the number of clicks of the chain
Definition:
inputs.h:23
lampda::logic::inputs::__private::ButtonEvent::isLongPress
bool isLongPress
indicates if this is a long press click
Definition:
inputs.h:21
lampda::logic::inputs::__private::ButtonEvent::longPressDuration
uint32_t longPressDuration
during a long press click, this is the press time. It goes to zero on release
Definition:
inputs.h:22
lampda::logic::inputs::__private::ButtonEvent::isEndOfLongPress
bool isEndOfLongPress
indicates if this is the end call of a long press click
Definition:
inputs.h:24
Generated by
1.9.6