Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
functions.h
Go to the documentation of this file.
1
5#ifndef USER_FUNCTIONS_H
6#define USER_FUNCTIONS_H
7
8//
9// code specific to LMBD_LAMP_TYPE=indexable
10//
11
12#include <cstdint>
13
16
17#ifdef LMBD_LAMP_TYPE__INDEXABLE
19
20// (extern declarations)
21namespace lampda::user::_private {
23}
24#endif
25
26//
27// code common to all lamp types
28//
29
31namespace lampda::user {
32
35
38
45void brightness_update(const lampda::brightness_t brightness);
46
48void sunset_timer_update(const float progress);
49
51void write_parameters();
52
54void read_parameters();
55
61bool button_start_click_default(const uint8_t clicks);
62
71bool button_start_hold_default(const uint8_t clicks, const bool isEndOfHoldEvent, const uint32_t holdDuration);
72
77void button_clicked_default(const uint8_t clicks);
78
94void button_hold_default(const uint8_t nbClickAndHold, const bool isEndOfHoldEvent, const uint32_t holdDuration);
95
103bool button_clicked_usermode(const uint8_t nbClick);
104
113bool button_hold_usermode(const uint8_t nbClickAndHold, const bool isEndOfHoldEvent, const uint32_t holdDuration);
114
119void loop();
120
126
132void user_thread();
133
138void handle_elk_command(const utils::ELK::Package& elkControlCommand);
139
140} // namespace lampda::user
141
142#endif
Handle the output LED strip brightness.
protected inheritence to avoid uncontroled hardware calls
Definition: strip.h:46
Decoder of the Bluetooth ELK messages.
Contains code handling custom user mode functions for indexable strips.
Definition: default_behavior.hpp:15
void brightness_update(const brightness_t brightness)
Called when the system changes the LED strip brightness.
Definition: default_behavior.hpp:56
void user_thread()
Called at each tick of the secondary thread.
Definition: default_behavior.hpp:159
bool button_hold_usermode(const uint8_t clicks, const bool isEndOfHoldEvent, const uint32_t holdDuration)
Called to handle button click+hold events if "usermode UI" is on.
Definition: default_behavior.hpp:133
bool button_start_hold_default(const uint8_t clicks, const bool isEndOfHoldEvent, const uint32_t holdDuration)
Called to handle button hold on lamp start.
Definition: default_behavior.hpp:101
void read_parameters()
Called when system wants to read parameters from filesystem.
Definition: default_behavior.hpp:93
void handle_elk_command(const utils::ELK::Package &elkControlCommand)
Handle a ELK BLE package.
Definition: indexable_behavior.hpp:228
void power_on_sequence()
Called when the system powers on (must be non blocking function!)
Definition: default_behavior.hpp:31
void sunset_timer_update(const float progress)
Called when the sunset timer progresses [0; 1].
Definition: default_behavior.hpp:79
bool button_start_click_default(const uint8_t clicks)
Called to handle button click on lamp start.
Definition: default_behavior.hpp:99
bool should_spawn_thread()
Determine if a second user_thread() loop thread should be spawned.
Definition: default_behavior.hpp:148
void write_parameters()
Called when system wants to write parameters to filesystem.
Definition: default_behavior.hpp:87
void button_hold_default(const uint8_t, const bool, const uint32_t)
Called to handle button click+hold events for user mode behaviors.
Definition: indexable_behavior.hpp:118
void power_off_sequence()
Called when the system powers off (must be non blocking function!)
Definition: default_behavior.hpp:42
void loop()
Called at each tick of the main loop.
Definition: default_behavior.hpp:139
void button_clicked_default(const uint8_t)
Called to handle button click events for default user mode behaviors.
Definition: indexable_behavior.hpp:18
bool button_clicked_usermode(const uint8_t clicks)
Called to handle button click events if "usermode UI" is active.
Definition: default_behavior.hpp:127
uint16_t brightness_t
Define the type of the brightness parameters.
Definition: constants.h:147
Interface of the indexable strip object. Only used for RGB lamp type.