Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lampda::modes::ContextTy< LocalBasicMode, ModeManager > Struct Template Reference

Local context exposing system features to active BasicMode. More...

#include <context_type.hpp>

Classes

struct  KeyProxy
 (store) Binds a local variable of type T to key in storage (with automatic read & save) More...
 

Public Types

using SelfTy = ContextTy< LocalBasicMode, ModeManager >
 Type of the Context of a local mode.
 
using ModeManagerTy = ModeManager
 Type of the mode manager.
 
using LocalModeTy = LocalBasicMode
 Type of a local mode.
 
using StateTy = StateTyOf< LocalModeTy >
 Type of the State of a local mode.
 

Public Member Functions

template<typename NewLocalMode >
auto LMBD_INLINE context_as ()
 Get the same context, but for another mode, see modes::context_as()
 
uint8_t LMBD_INLINE get_active_group (uint8_t maxValueWrap=255) const
 (getter) Get active group index
 
uint8_t LMBD_INLINE set_active_group (uint8_t value, uint8_t maxValueWrap=255)
 (setter) Set active group index
 
uint8_t LMBD_INLINE get_active_mode (uint8_t maxValueWrap=255) const
 (getter) Get active mode index (as numbered in local group)
 
uint8_t LMBD_INLINE set_active_mode (uint8_t value, uint8_t maxValueWrap=255)
 (setter) Set active mode index (as numbered in local group)
 
uint8_t LMBD_INLINE get_active_custom_ramp () const
 (getter) Get active custom ramp value (as configured by user)
 
uint8_t LMBD_INLINE set_active_custom_ramp (uint8_t value)
 (setter) Set active custom ramp value (overrides user choice)
 
uint8_t LMBD_INLINE get_active_custom_index () const
 (getter) Get active custom index (recalled when jumping favorites)
 
uint8_t LMBD_INLINE set_active_custom_index (uint8_t value)
 (setter) Set active custom index (recalled when jumping favorites)
 
template<typename Mode >
StateTyOf< Mode > & get_state_of_mode ()
 Return the state of a given mode.
 
template<ConfigKeys key>
void LMBD_INLINE set_config_bool (bool value)
 (setter) Set a configurable boolean to target value
 
template<ConfigKeys key>
void LMBD_INLINE set_config_u32 (uint32_t value)
 (setter) Set a configurable integer (u32) to target value
 
void blip (const uint32_t duration)
 Turn off the output for a duration.
 
void cancel_blip () const
 Cancel an ongoing blip of the ouput.
 
bool is_bliping () const
 Return true if the systems is currently bliping the output.
 
void LMBD_INLINE skipFirstLedsForFrames (uint8_t amount, uint8_t count=1)
 Skip the first few LEDs update during several frames.
 
void LMBD_INLINE enter_group (const uint8_t value)
 Call when entering a group.
 
void LMBD_INLINE quit_group ()
 Call when quitting a group.
 
void LMBD_INLINE enter_mode ()
 Call when entering a mode.
 
void LMBD_INLINE quit_mode ()
 Call when quitting a mode.
 
void LMBD_INLINE loop ()
 Binds to local BasicMode::loop()
 
void LMBD_INLINE on_enter_mode ()
 Binds to local BasicMode::on_enter_mode()
 
void LMBD_INLINE on_exit_mode ()
 Binds to local BasicMode::on_exit_mode()
 
void LMBD_INLINE sunset_update (LMBD_USED float progress)
 Binds to local BasicMode::sunset_update()
 
void LMBD_INLINE brightness_update (LMBD_USED brightness_t brightness)
 Binds to local BasicMode::brightness_update()
 
void LMBD_INLINE custom_ramp_update (LMBD_USED uint8_t rampValue, uint32_t timeout=0)
 Binds to local BasicMode::custom_ramp_update()
 
bool LMBD_INLINE custom_click (LMBD_USED uint8_t nbClick)
 Binds to local BasicMode::custom_click()
 
bool LMBD_INLINE custom_hold (LMBD_USED uint8_t nbClickAndHold, LMBD_USED bool isEndOfHoldEvent, LMBD_USED uint32_t holdDuration)
 Binds to local BasicMode::custom_hold()
 
template<bool displayFavoriteNumber = true>
auto LMBD_INLINE animate_favorite_pick (float holdDuration, float stepSize)
 
template<bool displayFavoriteNumber = true>
auto LMBD_INLINE animate_favorite_delete (float holdDuration, float stepSize)
 
void LMBD_INLINE power_on_sequence ()
 Binds to local BasicMode::power_on_sequence()
 
void LMBD_INLINE power_off_sequence ()
 Binds to local BasicMode::power_off_sequence()
 
void LMBD_INLINE write_parameters ()
 Binds to local BasicMode::write_parameters()
 
void LMBD_INLINE read_parameters ()
 Binds to local BasicMode::read_parameters()
 
bool LMBD_INLINE should_spawn_thread ()
 Returns BasicMode::requireUserThread.
 
void LMBD_INLINE user_thread ()
 Binds to local BasicMode::user_thread()
 

Static Public Member Functions

template<typename Mode >
static constexpr int get_group_id_of_mode ()
 Return the id of the group containing a target mode, or -1 if it does not exist.
 
template<typename Mode >
static constexpr int get_mode_id ()
 Return the.
 
template<StoreEnum key, typename T = uint32_t>
static auto LMBD_INLINE storageFor (LMBD_USED T &local)
 (store) Get storage KeyProxy for key bound to local variable
 
template<StoreEnum key, typename T = uint32_t>
static bool LMBD_INLINE storageLoadOnly (LMBD_USED T &local)
 (store) Load key into local if available (single-shot)
 
template<StoreEnum key, typename T = uint32_t>
static void LMBD_INLINE storageSaveOnly (LMBD_USED T &local)
 (store) Save local into key storage (single-shot)
 

Public Attributes

friend ModeManager
 Friend class.
 
hardware::LampTylamp
 Interact with the lamp hardware.
 
StateTystate
 Interact with the current active mode state.
 

Static Public Attributes

static constexpr bool isGroupManager = false
 
static constexpr bool hasStore = not std::is_same_v<StoreEnum, NoStoreHere>
 (store) True if LocalBasicMode has access to a local key store
 

Detailed Description

template<typename LocalBasicMode, typename ModeManager>
struct lampda::modes::ContextTy< LocalBasicMode, ModeManager >

Local context exposing system features to active BasicMode.

Member Function Documentation

◆ blip()

template<typename LocalBasicMode , typename ModeManager >
void lampda::modes::ContextTy< LocalBasicMode, ModeManager >::blip ( const uint32_t  duration)
inline

Turn off the output for a duration.

Parameters
[in]durationin milliseconds

◆ get_active_custom_ramp()

template<typename LocalBasicMode , typename ModeManager >
uint8_t LMBD_INLINE lampda::modes::ContextTy< LocalBasicMode, ModeManager >::get_active_custom_ramp ( ) const
inline

(getter) Get active custom ramp value (as configured by user)

See also
BasicMode::custom_ramp_update()

◆ set_active_custom_ramp()

template<typename LocalBasicMode , typename ModeManager >
uint8_t LMBD_INLINE lampda::modes::ContextTy< LocalBasicMode, ModeManager >::set_active_custom_ramp ( uint8_t  value)
inline

(setter) Set active custom ramp value (overrides user choice)

See also
BasicMode::custom_ramp_update()

◆ set_config_bool()

template<typename LocalBasicMode , typename ModeManager >
template<ConfigKeys key>
void LMBD_INLINE lampda::modes::ContextTy< LocalBasicMode, ModeManager >::set_config_bool ( bool  value)
inline

(setter) Set a configurable boolean to target value

See modes::ConfigKeys for documentation of configurable booleans.

◆ set_config_u32()

template<typename LocalBasicMode , typename ModeManager >
template<ConfigKeys key>
void LMBD_INLINE lampda::modes::ContextTy< LocalBasicMode, ModeManager >::set_config_u32 ( uint32_t  value)
inline

(setter) Set a configurable integer (u32) to target value

See modes::ConfigKeys for documentation of configurable (u32) integers.

◆ skipFirstLedsForFrames()

template<typename LocalBasicMode , typename ModeManager >
void LMBD_INLINE lampda::modes::ContextTy< LocalBasicMode, ModeManager >::skipFirstLedsForFrames ( uint8_t  amount,
uint8_t  count = 1 
)
inline

Skip the first few LEDs update during several frames.

Next calls to modes::hardware::LampTy::setPixelColor() no longer write on the amount first lower LEDs, making them static.

See modes::colors::rampColorRing


The documentation for this struct was generated from the following file: