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
15
17
18#ifdef LMBD_LAMP_TYPE__INDEXABLE
20
21// (extern declarations)
22namespace lampda::user::_private {
24}
25#endif
26
27//
28// code common to all lamp types
29//
30
32namespace lampda::user {
33
36
39
46void brightness_update(const lampda::brightness_t brightness);
47
49void write_parameters();
50
52void read_parameters();
53
59bool button_start_click_default(const uint8_t clicks);
60
69bool button_start_hold_default(const uint8_t clicks, const bool isEndOfHoldEvent, const uint32_t holdDuration);
70
76bool button_clicked_default(const uint8_t clicks);
77
93bool button_hold_default(const uint8_t nbClickAndHold, const bool isEndOfHoldEvent, const uint32_t holdDuration);
94
102bool button_clicked_usermode(const uint8_t nbClick);
103
112bool button_hold_usermode(const uint8_t nbClickAndHold, const bool isEndOfHoldEvent, const uint32_t holdDuration);
113
118void loop();
119
125
131void user_thread();
132
137void handle_user_command(const common::UserCommand& setCommand);
138
139} // namespace lampda::user
140
141#endif
Handle the output LED strip brightness.
protected inheritence to avoid uncontroled hardware calls
Definition: strip.h:45
Contains code handling custom user mode functions for indexable strips.
Definition: default_behavior.hpp:23
bool button_clicked_default(const uint8_t)
Called to handle button click events for default user mode behaviors.
Definition: indexable_behavior.hpp:20
bool 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:166
void brightness_update(const brightness_t brightness)
Called when the system changes the LED strip brightness.
Definition: default_behavior.hpp:64
void user_thread()
Called at each tick of the secondary thread.
Definition: default_behavior.hpp:199
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:173
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:102
void read_parameters()
Called when system wants to read parameters from filesystem.
Definition: default_behavior.hpp:94
void power_on_sequence()
Called when the system powers on (must be non blocking function!)
Definition: default_behavior.hpp:39
bool button_start_click_default(const uint8_t clicks)
Called to handle button click on lamp start.
Definition: default_behavior.hpp:100
void handle_user_command(const common::UserCommand &command)
Handle user command.
Definition: indexable_behavior.hpp:399
bool should_spawn_thread()
Determine if a second user_thread() loop thread should be spawned.
Definition: default_behavior.hpp:188
void write_parameters()
Called when system wants to write parameters to filesystem.
Definition: default_behavior.hpp:88
void power_off_sequence()
Called when the system powers off (must be non blocking function!)
Definition: default_behavior.hpp:50
void loop()
Called at each tick of the main loop.
Definition: default_behavior.hpp:179
bool button_clicked_usermode(const uint8_t clicks)
Called to handle button click events if "usermode UI" is active.
Definition: default_behavior.hpp:167
uint16_t brightness_t
Define the type of the brightness parameters.
Definition: constants.h:151
Interface of the indexable strip object. Only used for RGB lamp type.