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 sunset_timer_update(const float progress);
50
52void write_parameters();
53
55void read_parameters();
56
62bool button_start_click_default(const uint8_t clicks);
63
72bool button_start_hold_default(const uint8_t clicks, const bool isEndOfHoldEvent, const uint32_t holdDuration);
73
79bool button_clicked_default(const uint8_t clicks);
80
96bool button_hold_default(const uint8_t nbClickAndHold, const bool isEndOfHoldEvent, const uint32_t holdDuration);
97
105bool button_clicked_usermode(const uint8_t nbClick);
106
115bool button_hold_usermode(const uint8_t nbClickAndHold, const bool isEndOfHoldEvent, const uint32_t holdDuration);
116
121void loop();
122
128
134void user_thread();
135
140void handle_user_command(const common::UserCommand& setCommand);
141
142} // namespace lampda::user
143
144#endif
Handle the output LED strip brightness.
protected inheritence to avoid uncontroled hardware calls
Definition: strip.h:49
Contains code handling custom user mode functions for indexable strips.
Definition: default_behavior.hpp:17
bool button_clicked_default(const uint8_t)
Called to handle button click events for default user mode behaviors.
Definition: indexable_behavior.hpp:18
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:168
void brightness_update(const brightness_t brightness)
Called when the system changes the LED strip brightness.
Definition: default_behavior.hpp:58
void user_thread()
Called at each tick of the secondary thread.
Definition: default_behavior.hpp:161
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:135
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:103
void read_parameters()
Called when system wants to read parameters from filesystem.
Definition: default_behavior.hpp:95
void power_on_sequence()
Called when the system powers on (must be non blocking function!)
Definition: default_behavior.hpp:33
void sunset_timer_update(const float progress)
Called when the sunset timer progresses [0; 1].
Definition: default_behavior.hpp:81
bool button_start_click_default(const uint8_t clicks)
Called to handle button click on lamp start.
Definition: default_behavior.hpp:101
void handle_user_command(const common::UserCommand &command)
Handle user command.
Definition: indexable_behavior.hpp:283
bool should_spawn_thread()
Determine if a second user_thread() loop thread should be spawned.
Definition: default_behavior.hpp:150
void write_parameters()
Called when system wants to write parameters to filesystem.
Definition: default_behavior.hpp:89
void power_off_sequence()
Called when the system powers off (must be non blocking function!)
Definition: default_behavior.hpp:44
void loop()
Called at each tick of the main loop.
Definition: default_behavior.hpp:141
bool button_clicked_usermode(const uint8_t clicks)
Called to handle button click events if "usermode UI" is active.
Definition: default_behavior.hpp:129
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.