10#define max(a, b) ((a) > (b) ? (a) : (b))
22 digitalWrite(
pin_, state);
36 static bool blipping =
false;
44 bool const orig_state = this->
state_;
48 duration, [
this, duration, orig_state, current_counter]() {
54 duration, [
this, orig_state, new_counter]() {
71 bool const was_enabled = this->
enabled_;
107 int const off_duration =
max(0,
period_ - on_duration);
108 unsigned int const ref_duration =
109 state_ ==
false ? off_duration : on_duration;
111 ref_duration, [
this]() { this->
tick(); });
A base class for LED blinker classes.
void set_state(bool state)
void set_enabled(bool state)
void blip(int duration=20)
EvenBlinker(int pin, unsigned int period)
void tick() override final
PatternBlinker(int pin, int pattern[])
void set_pattern(int pattern[])
unsigned int pattern_ptr_
void tick() override final
A base class for periodic blinkers.
PeriodicBlinker(int pin, unsigned int period)
RatioBlinker(int pin, unsigned int period, float ratio=0.)
void tick() override final
std::shared_ptr< reactesp::EventLoop > event_loop()