Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Functions | Variables
lampda::logic::user_command_queue Namespace Reference

Defer the user commands to the main loop. More...

Functions

bool post (const common::UserCommand &command)
 Post a user command, run by the main loop on its next tick. Thread safe.
 
void request_brightness_user_callback ()
 Request a call to the user brightness callback (see brightness::force_brightness_user_callback()), run by the main loop on its next tick, after the posted commands. Thread safe. Several requests before the next tick result in a single call.
 
size_t get_pending_count ()
 Return the number of commands waiting for the main loop. Thread safe.
 
void loop ()
 Main loop only: run the posted commands, in order, then the requested brightness callback.
 

Variables

static constexpr size_t maxStoredCommands = 16
 Maximum number of commands waiting for the main loop.
 

Detailed Description

Defer the user commands to the main loop.

Function Documentation

◆ post()

bool lampda::logic::user_command_queue::post ( const common::UserCommand &  command)

Post a user command, run by the main loop on its next tick. Thread safe.

Parameters
[in]commandThe command to run
Returns
false if the queue is full and the command was dropped