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

Handle the LED output brightness. More...

Classes

struct  BrightnessParameters
 Store the brightness characteristics. More...
 

Functions

brightness_t get_brightness ()
 Return the current brightness value.
 
brightness_t get_max_brightness ()
 Return the maximum allowed brightness.
 
brightness_t get_max_user_brightness ()
 Return the maximum allowed brightness for the user modes.
 
void set_max_brightness (const brightness_t brg)
 Set the new max brightness.
 
void set_user_brightness_scale (const float scale)
 Scale the brightness available to the user modes, without changing the saved brightness. The maximum user brightness and the saved brightness scale together, so a mode animating around the saved brightness keeps its look at any scale. The scale is reset to 1 by update_saved_brightness.
 
void update_saved_brightness ()
 Update the saved brightness value with the current brightness.
 
brightness_t get_saved_brightness ()
 Return the saved brightness level. This should be the prefered option in all computations.
 
brightness_t get_scaled_saved_brightness ()
 Return the saved brightness level, with the user brightness scale applied. This is the level that the user modes should follow. See set_user_brightness_scale.
 
void update_brightness (const brightness_t newBrightness, const bool shouldSkipUserCallbacks=false)
 update the internal brightness values
 
void force_brightness_user_callback ()
 force an update call to the user brightness callback
 
uint32_t when_last_update_brightness ()
 Get time in milliseconds when brightness was last updated.
 

Variables

BrightnessParameters __internal
 

Detailed Description

Handle the LED output brightness.

Function Documentation

◆ get_brightness()

brightness_t lampda::logic::brightness::get_brightness ( )

Return the current brightness value.

It's value depends on a lot of factors and can be cantrolled by any actors.

◆ set_max_brightness()

void lampda::logic::brightness::set_max_brightness ( const brightness_t  brg)

Set the new max brightness.

Parameters
[in]brgNew brightness, limited to brightness::absoluteMaximumBrightness

◆ set_user_brightness_scale()

void lampda::logic::brightness::set_user_brightness_scale ( const float  scale)

Scale the brightness available to the user modes, without changing the saved brightness. The maximum user brightness and the saved brightness scale together, so a mode animating around the saved brightness keeps its look at any scale. The scale is reset to 1 by update_saved_brightness.

Parameters
[in]scalebetween 0 and 1

◆ update_brightness()

void lampda::logic::brightness::update_brightness ( const brightness_t  newBrightness,
const bool  shouldSkipUserCallbacks = false 
)

update the internal brightness values

Parameters
[in]newBrightnessthe new brightness value
[in]shouldSkipUserCallbacksTrue if this will skip the user callback call