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
#include "
src/system/utils/queue.h
"
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
uint32_t
clickCount
;
24
bool
isEndOfLongPress
=
false
;
25
};
26
27
static
constexpr
size_t
maxButtonEventStore
=
28
15;
29
30
extern
utils::Queue<ButtonEvent, maxButtonEventStore>
buttonEventQueue
;
31
32
}
// namespace __private
33
36
void
init
(
const
bool
wasPoweredByUserInterrupt);
37
39
void
loop
();
40
42
void
button_disable_usermode
();
43
45
bool
is_button_usermode_enabled
();
46
48
bool
add_button_click_event
(uint32_t clickCount);
50
bool
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
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::buttonEventQueue
utils::Queue< ButtonEvent, maxButtonEventStore > buttonEventQueue
button event asynchroneous queue
Definition:
inputs.cpp:33
lampda::logic::inputs::add_button_click_event
bool add_button_click_event(uint32_t clickCount)
Signal a button click event.
Definition:
inputs.cpp:606
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:614
lampda::logic::inputs::is_button_usermode_enabled
bool is_button_usermode_enabled()
return true if custom user modes are enabled
Definition:
inputs.cpp:604
lampda::logic::inputs::button_disable_usermode
void button_disable_usermode()
disable custom user modes
Definition:
inputs.cpp:602
lampda::logic::inputs::loop
void loop()
Call often to handle button updates.
Definition:
inputs.cpp:567
lampda::logic::inputs::init
void init(const bool wasPoweredByUserInterrupt)
Call once on system start.
Definition:
inputs.cpp:561
lampda
Program scope.
Definition:
control_fixed_modes.hpp:12
queue.h
Define a queue object with constant memory footprint.
lampda::logic::inputs::__private::ButtonEvent
Definition:
inputs.h:20
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::clickCount
uint32_t clickCount
keep track of the number of clicks of the chain
Definition:
inputs.h:23
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
lampda::utils::Queue
Definition:
queue.h:16
Generated by
1.9.6