Loading [MathJax]/extensions/tex2jax.js
SensESP 3.1.0
Universal Signal K sensor toolkit ESP32
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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

CRGB & crgb_
 
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 189 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 191 of file led_blinker.h.

Member Function Documentation

◆ add_modifier()

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

Definition at line 213 of file led_blinker.h.

◆ set_pattern()

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

Definition at line 211 of file led_blinker.h.

◆ tick()

void sensesp::LEDBlinker::tick ( )
inline

Definition at line 193 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 218 of file led_blinker.h.

◆ last_color_

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

Definition at line 219 of file led_blinker.h.

◆ modifiers_

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

Definition at line 221 of file led_blinker.h.

◆ pattern_

LEDPattern sensesp::LEDBlinker::pattern_
protected

Definition at line 220 of file led_blinker.h.

◆ show_func_

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

Definition at line 223 of file led_blinker.h.


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