1#ifndef SENSESP_SYSTEM_LED_BLINKER_H_
2#define SENSESP_SYSTEM_LED_BLINKER_H_
12#define PATTERN_END (-1)
28 digitalWrite(
pin_, state);
40 void blip(
int duration = 20) {
42 static bool blipping =
false;
50 bool const orig_state = this->
state_;
54 duration, [
this, duration, orig_state, current_counter]() {
59 event_loop()->onDelay(duration, [
this, orig_state, new_counter]() {
76 bool const was_enabled = this->
enabled_;
129 LEDPattern(
const std::initializer_list<LEDPatternFragment>& fragments)
147 unsigned long current_fragment_duration_ms =
158 current_fragment_duration_ms =
199 std::list<LEDPattern>::iterator it =
modifiers_.begin();
229 uint32_t fade_duration_ms,
230 const CRGB& target_color);
232 bool reverse =
false);
234 bool reverse =
false);
void set_state(bool state)
void set_enabled(bool state)
void blip(int duration=20)
std::function< void()> show_func_
void add_modifier(const LEDPattern &modifier)
void set_pattern(const LEDPattern &pattern)
std::list< LEDPattern > modifiers_
LEDBlinker(CRGB &crgb, LEDPattern pattern, std::function< void()> show_func)
LEDPatternFragment(const LEDPatternFragment &other)
LEDPatternFragment & operator=(const LEDPatternFragment &other)
FragmentCallback callback_
LEDPatternFragment(uint32_t duration_ms, FragmentCallback callback)
LEDPattern(const std::vector< LEDPatternFragment > &fragments)
unsigned long fragment_begin_ms_
bool apply(CRGB &crgb, bool oneshot=false)
uint32_t current_fragment_idx_
std::vector< LEDPatternFragment > fragments_
LEDPattern(const std::initializer_list< LEDPatternFragment > &fragments)
LEDPattern & operator=(const LEDPattern &other)
std::shared_ptr< reactesp::EventLoop > event_loop()
LEDPatternFragment frag_linear_fade(uint32_t duration_ms, uint32_t fade_duration_ms, const CRGB &target_color)
LEDPatternFragment frag_nop(uint32_t duration_ms)
LEDPatternFragment frag_blend(uint32_t duration_ms, const CRGB &target_color, bool reverse)
std::function< void(uint32_t, CRGB &)> FragmentCallback
LEDPatternFragment frag_linear_invert(uint32_t duration_ms, bool reverse)
LEDPatternFragment frag_solid_color(uint32_t duration_ms, const CRGB &color)
Minimal RGB color struct.