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 <cstdint>
9
10
#include "
src/system/common/queue.h
"
11
12
namespace
lampda
{
13
namespace
logic {
15
namespace
inputs {
16
18
namespace
__private {
19
20
struct
ButtonEvent
21
{
22
bool
isLongPress
=
false
;
23
uint32_t
longPressDuration
;
24
uint32_t
clickCount
;
25
bool
isEndOfLongPress
=
false
;
26
};
27
28
static
constexpr
size_t
maxButtonEventStore
=
29
15;
30
31
extern
common::Queue<ButtonEvent, maxButtonEventStore>
buttonEventQueue
;
32
33
}
// namespace __private
34
37
void
init
(
const
bool
wasPoweredByUserInterrupt);
38
40
void
loop
();
41
43
void
button_disable_usermode
();
44
46
bool
is_button_usermode_enabled
();
47
49
bool
add_button_click_event
(uint32_t clickCount);
51
bool
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
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:28
lampda::logic::inputs::__private::buttonEventQueue
common::Queue< ButtonEvent, maxButtonEventStore > buttonEventQueue
button event asynchroneous queue
Definition:
inputs.cpp:34
lampda::logic::inputs::add_button_click_event
bool add_button_click_event(uint32_t clickCount)
Signal a button click event.
Definition:
inputs.cpp:607
lampda::logic::inputs::add_button_press_event
bool add_button_press_event(uint32_t clickCount, uint32_t pressDuration, bool isEndOfPress)
Signal a button press event.
Definition:
inputs.cpp:615
lampda::logic::inputs::is_button_usermode_enabled
bool is_button_usermode_enabled()
return true if custom user modes are enabled
Definition:
inputs.cpp:605
lampda::logic::inputs::button_disable_usermode
void button_disable_usermode()
disable custom user modes
Definition:
inputs.cpp:603
lampda::logic::inputs::loop
void loop()
Call often to handle button updates.
Definition:
inputs.cpp:568
lampda::logic::inputs::init
void init(const bool wasPoweredByUserInterrupt)
Call once on system start.
Definition:
inputs.cpp:562
lampda
Program scope.
Definition:
control_fixed_modes.hpp:12
queue.h
Define a queue object with constant memory footprint.
lampda::common::Queue
Definition:
queue.h:15
lampda::logic::inputs::__private::ButtonEvent
Definition:
inputs.h:21
lampda::logic::inputs::__private::ButtonEvent::isLongPress
bool isLongPress
indicates if this is a long press click
Definition:
inputs.h:22
lampda::logic::inputs::__private::ButtonEvent::clickCount
uint32_t clickCount
keep track of the number of clicks of the chain
Definition:
inputs.h:24
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:23
lampda::logic::inputs::__private::ButtonEvent::isEndOfLongPress
bool isEndOfLongPress
indicates if this is the end call of a long press click
Definition:
inputs.h:25
Generated by
1.9.6