Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Namespaces | Functions
brightness_handle.h File Reference

Handle the output LED strip brightness. More...

Go to the source code of this file.

Namespaces

namespace  lampda
 Program scope.
 
namespace  lampda::logic
 Handle the main high level logics.
 
namespace  lampda::logic::brightness
 Handle the LED output brightness.
 
namespace  lampda::logic::indicator
 Handle the indicator brightness.
 

Functions

brightness_t lampda::logic::brightness::get_brightness ()
 Return the current brightness value.
 
brightness_t lampda::logic::brightness::get_saved_brightness ()
 Return the saved brightness level. This should be the prefered option in all computations.
 
brightness_t lampda::logic::brightness::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.
 
brightness_t lampda::logic::brightness::get_max_brightness ()
 Return the maximum allowed brightness.
 
brightness_t lampda::logic::brightness::get_max_user_brightness ()
 Return the maximum allowed brightness for the user modes.
 
void lampda::logic::brightness::set_max_brightness (const brightness_t brg)
 Set the new max brightness.
 
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.
 
void lampda::logic::brightness::update_saved_brightness ()
 Update the saved brightness value with the current brightness.
 
void lampda::logic::brightness::update_brightness (const brightness_t newBrightness, const bool shouldSkipUserCallbacks=false)
 update the internal brightness values
 
void lampda::logic::brightness::force_brightness_user_callback ()
 force an update call to the user brightness callback
 
uint32_t lampda::logic::brightness::when_last_update_brightness ()
 Get time in milliseconds when brightness was last updated.
 
void lampda::logic::indicator::set_brightness_level (const uint8_t level)
 Set the brightness of the RGB indicator. Indicator level can be 0 : indicator and alerts displayed at full brightness 1 : indicator and alerts displayed at low brightness 2 : indicator and alerts displayed at low brightness, indicator off when charging After a level update, the normal indicator stays visible for 5 seconds, even while charging at level 2.
 
uint8_t lampda::logic::indicator::get_brightness_level ()
 Get the brightness of the RGB indicator. Indicator level can be 0 : indicator and alerts displayed at full brightness 1 : indicator and alerts displayed at low brightness 2 : indicator and alerts displayed at low brightness, indicator off when charging After a level update, the normal indicator stays visible for 5 seconds, even while charging at level 2.
 
bool lampda::logic::indicator::should_indicator_be_visible ()
 indicates if the indicator should be visible or not
 
void lampda::logic::indicator::set_color_override (const uint8_t red, const uint8_t green, const uint8_t blue)
 Replace the battery level color of the indicator by a fixed color. The indicator animations (charge, output, ...) are kept, only their color changes. Alerts are not affected and always take precedence. This color is not saved.
 
void lampda::logic::indicator::clear_color_override ()
 Restore the default (battery level) color of the indicator.
 
bool lampda::logic::indicator::get_color_override (uint32_t &color)
 Get the color that replaces the battery level color, if any.
 

Detailed Description

Handle the output LED strip brightness.