SensESP 3.4.1-alpha
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::LEDBlinker Class Reference

Blink the LED with a pattern specified by a vector of callback functions. More...

#include <sensesp/system/led_blinker.h>

Public Member Functions

 LEDBlinker (CRGB &crgb, LEDPattern pattern, std::function< void()> show_func)
 
void tick ()
 
void set_pattern (const LEDPattern &pattern)
 
void add_modifier (const LEDPattern &modifier)
 

Protected Attributes

CRGBcrgb_
 
CRGB last_color_ = CRGB::Black
 
LEDPattern pattern_
 
std::list< LEDPatternmodifiers_ = {}
 
std::function< void()> show_func_
 

Detailed Description

Blink the LED with a pattern specified by a vector of callback functions.

LED blinker class that blinks the LED with a pattern specified by a vector of callback functions. Each callback function is called in sequence, with the duration of each callback function specified in the LEDPatternFragment object.

In addition to the pattern, there can be one or more transient modifiers that modify the LED color during the pattern. These modifiers are applied in sequence on top of the pattern. They can be used e.g. to change the color, dim the LED, or apply a brief fade effect to indicate e.g. a button press or received data.

Definition at line 186 of file led_blinker.h.

Constructor & Destructor Documentation

◆ LEDBlinker()

sensesp::LEDBlinker::LEDBlinker ( CRGB crgb,
LEDPattern  pattern,
std::function< void()>  show_func 
)
inline

Definition at line 188 of file led_blinker.h.

Member Function Documentation

◆ add_modifier()

void sensesp::LEDBlinker::add_modifier ( const LEDPattern modifier)
inline

Definition at line 210 of file led_blinker.h.

◆ set_pattern()

void sensesp::LEDBlinker::set_pattern ( const LEDPattern pattern)
inline

Definition at line 208 of file led_blinker.h.

◆ tick()

void sensesp::LEDBlinker::tick ( )
inline

Definition at line 190 of file led_blinker.h.

Here is the call graph for this function:

Member Data Documentation

◆ crgb_

CRGB& sensesp::LEDBlinker::crgb_
protected

Definition at line 215 of file led_blinker.h.

◆ last_color_

CRGB sensesp::LEDBlinker::last_color_ = CRGB::Black
protected

Definition at line 216 of file led_blinker.h.

◆ modifiers_

std::list<LEDPattern> sensesp::LEDBlinker::modifiers_ = {}
protected

Definition at line 218 of file led_blinker.h.

◆ pattern_

LEDPattern sensesp::LEDBlinker::pattern_
protected

Definition at line 217 of file led_blinker.h.

◆ show_func_

std::function<void()> sensesp::LEDBlinker::show_func_
protected

Definition at line 220 of file led_blinker.h.


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