|
Lamp-Da 0.1
A compact lantern project
|
private handling namespace, used for unit testing More...
Classes | |
| struct | ButtonEvent |
| struct | ButtonEventQueueLock |
| Hold _buttonEventQueueMutex for the scope. More... | |
Functions | |
| bool | pop_button_event (ButtonEvent &event) |
| Pop the oldest button event. Thread safe. Return false if there is no event. | |
| size_t | get_button_event_count () |
| Return the number of stored button events. Thread safe. | |
| void | clear_button_events () |
| Drop all stored button events. Thread safe. | |
| bool | push_button_event (const ButtonEvent &event, const size_t maxFillPercent) |
Push a button event, if the queue fill stays below maxFillPercent. Thread safe. | |
| void | handle_brightness_change (uint8_t consecutiveButtonCheck, uint32_t buttonHoldDuration, bool isEndOfHoldEvent) |
| Handle a brightness change control: 1 long clic raises brightness to maximum, then goes down if press continue, then shuts down the system. 2 long clics lower brightness to minimum, then if press continue shuts down the system. | |
Variables | |
| static etl::queue< ButtonEvent, maxButtonEventStore > | buttonEventQueue |
| Button event asynchroneous queue: filled by the button thread, emptied by the main loop. etl::queue is not thread safe: only access it under _buttonEventQueueMutex. | |
| static hal::mutex::hal_mutex_t | _buttonEventQueueMutex |
| Guards buttonEventQueue. Never held while running the button callbacks. Not recursive. | |
| static const bool | _isButtonEventQueueMutexInit |
| Initialized at program start: events can be pushed as soon as the button thread starts. | |
| static constexpr size_t | maxButtonEventStore |
| this event count should be high enough to not miss clicks and ramp events | |
private handling namespace, used for unit testing
| void lampda::logic::inputs::__private::handle_brightness_change | ( | uint8_t | consecutiveButtonCheck, |
| uint32_t | buttonHoldDuration, | ||
| bool | isEndOfHoldEvent | ||
| ) |
Handle a brightness change control: 1 long clic raises brightness to maximum, then goes down if press continue, then shuts down the system. 2 long clics lower brightness to minimum, then if press continue shuts down the system.
< keep track of the ramp side : up of down
< keep track of the latest brightness saturation press duration
user controled brightness, no more sunrise
go up
|
static |
Initialized at program start: events can be pushed as soon as the button thread starts.
|
staticconstexpr |
this event count should be high enough to not miss clicks and ramp events