Addressable Lights

API Reference

namespace light

Functions

static uint8_t esp_scale8(uint8_t i, uint8_t scale)
class AddressableLight : public light::LightOutput

Subclassed by light::FastLEDLightOutputComponent, light::NeoPixelBusLightOutputBase< T_METHOD, T_COLOR_FEATURE >

Public Functions

AddressableLight()
virtual int32_t size() const = 0
virtual ESPColorView operator[](int32_t index) const = 0
virtual void clear_effect_data() = 0
bool is_effect_active() const
void set_effect_active(bool effect_active)

Protected Attributes

bool effect_active_ = {false}
struct ESPColor

Public Functions

ESPColor()
ESPColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t white)
ESPColor(uint8_t red, uint8_t green, uint8_t blue)
ESPColor(uint32_t colorcode)
ESPColor(const ESPColor &rhs)
bool is_on()
ESPColor &operator=(const ESPColor &rhs)
ESPColor &operator=(const uint32_t colorcode)
uint8_t &operator[](uint8_t x)
ESPColor operator*(uint8_t scale) const
ESPColor &operator*=(uint8_t scale)
ESPColor operator*(const ESPColor &scale) const
ESPColor &operator*=(const ESPColor &scale)
ESPColor operator+(const ESPColor &add) const
ESPColor &operator+=(const ESPColor &add)
ESPColor operator+(uint8_t add) const
ESPColor &operator+=(uint8_t add)
ESPColor operator-(const ESPColor &subtract) const
ESPColor &operator-=(const ESPColor &subtract)
ESPColor operator-(uint8_t subtract) const
ESPColor &operator-=(uint8_t subtract)

Public Members

uint8_t r
uint8_t red
uint8_t g
uint8_t green
uint8_t b
uint8_t blue
uint8_t w
uint8_t white
uint8_t raw[4]
union light::ESPColor::[anonymous] [anonymous]

Public Static Functions

ESPColor HOT light::ESPColor::random_color()
class ESPColorCorrection

Public Functions

ESPColorCorrection()
void set_max_brightness(const ESPColor &max_brightness)
void set_local_brightness(uint8_t local_brightness)
void calculate_gamma_table(float gamma)
ESPColor color_correct(ESPColor color) const
uint8_t color_correct_red(uint8_t red) const
uint8_t color_correct_green(uint8_t green) const
uint8_t color_correct_blue(uint8_t blue) const
uint8_t color_correct_white(uint8_t white) const
ESPColor color_uncorrect(ESPColor color) const
uint8_t color_uncorrect_red(uint8_t red) const
uint8_t color_uncorrect_green(uint8_t green) const
uint8_t color_uncorrect_blue(uint8_t blue) const
uint8_t color_uncorrect_white(uint8_t white) const

Protected Attributes

uint8_t gamma_table_[256]
uint8_t gamma_reverse_table_[256]
ESPColor max_brightness_
uint8_t local_brightness_ = {255}
class ESPColorView

Public Functions

ESPColorView(uint8_t *red, uint8_t *green, uint8_t *blue, uint8_t *white, uint8_t *effect_data, const ESPColorCorrection *color_correction)
const ESPColorView &operator=(const ESPColor &rhs) const
const ESPColorView &operator=(const ESPHSVColor &rhs) const
void set(const ESPColor &color) const
void set(const ESPHSVColor &color) const
void set_red(uint8_t red) const
void set_green(uint8_t green) const
void set_blue(uint8_t blue) const
void set_white(uint8_t white) const
void set_rgb(uint8_t red, uint8_t green, uint8_t blue) const
void set_rgbw(uint8_t red, uint8_t green, uint8_t blue, uint8_t white) const
void set_effect_data(uint8_t effect_data) const
ESPColor get() const
uint8_t get_red() const
uint8_t get_green() const
uint8_t get_blue() const
uint8_t get_white() const
uint8_t get_effect_data() const

Protected Attributes

uint8_t *const red_
uint8_t *const green_
uint8_t *const blue_
uint8_t *const white_
uint8_t *const effect_data_
const ESPColorCorrection *const color_correction_
struct ESPHSVColor

Public Functions

ESPHSVColor()
ESPHSVColor(uint8_t hue, uint8_t saturation, uint8_t value)
ESPColor HOT light::ESPHSVColor::to_rgb() const

Public Members

uint8_t hue
uint8_t h
uint8_t saturation
uint8_t s
uint8_t value
uint8_t v
uint8_t raw[3]
union light::ESPHSVColor::[anonymous] [anonymous]

Addressable Light Effects

namespace light
class AddressableColorWipeEffect : public light::AddressableLightEffect

Public Functions

AddressableColorWipeEffect(const std::string &name)
void set_colors(const std::vector<AddressableColorWipeEffectColor> &colors)
void set_add_led_interval(uint32_t add_led_interval)
void set_reverse(bool reverse)
void apply(AddressableLight &it, const ESPColor &current_color)

Protected Attributes

std::vector<AddressableColorWipeEffectColor> colors_
size_t at_color_ = {0}
uint32_t last_add_ = {0}
uint32_t add_led_interval_ = {100}
size_t leds_added_ = {0}
bool reverse_ = {false}
struct AddressableColorWipeEffectColor

Public Members

uint8_t r
uint8_t g
uint8_t b
uint8_t w
bool random
size_t num_leds
class AddressableFireworksEffect : public light::AddressableLightEffect

Public Functions

AddressableFireworksEffect(const std::string &name)
void start()
void apply(AddressableLight &it, const ESPColor &current_color)
void set_update_interval(uint32_t update_interval)
void set_spark_probability(float spark_probability)
void set_use_random_color(bool random_color)
void set_fade_out_rate(uint8_t fade_out_rate)

Protected Attributes

uint8_t fade_out_rate_ = {120}
uint32_t update_interval_ = {32}
uint32_t last_update_ = {0}
float spark_probability_ = {0.10f}
bool use_random_color_ = {false}
class AddressableFlickerEffect : public light::AddressableLightEffect

Public Functions

AddressableFlickerEffect(const std::string &name)
void apply(AddressableLight &it, const ESPColor &current_color)
void set_update_interval(uint32_t update_interval)
void set_intensity(float intensity)

Protected Attributes

uint32_t update_interval_ = {16}
uint32_t last_update_ = {0}
uint8_t intensity_ = {13}
class AddressableLambdaLightEffect : public light::AddressableLightEffect

Public Functions

AddressableLambdaLightEffect(const std::string &name, const std::function<void(AddressableLight&)> &f, uint32_t update_interval, )
void apply(AddressableLight &it, const ESPColor &current_color)

Protected Attributes

std::function<void(AddressableLight&)> f_
uint32_t update_interval_
uint32_t last_run_ = {0}
class AddressableLightEffect : public light::LightEffect

Subclassed by light::AddressableColorWipeEffect, light::AddressableFireworksEffect, light::AddressableFlickerEffect, light::AddressableLambdaLightEffect, light::AddressableRainbowLightEffect, light::AddressableRandomTwinkleEffect, light::AddressableScanEffect, light::AddressableTwinkleEffect

Public Functions

AddressableLightEffect(const std::string &name)
void start_()
void stop()
virtual void apply(AddressableLight &it, const ESPColor &current_color) = 0
void apply()

Protected Functions

AddressableLight *get_addressable_() const

Protected Attributes

HighFrequencyLoopRequester high_freq_
class AddressableRainbowLightEffect : public light::AddressableLightEffect

Public Functions

AddressableRainbowLightEffect(const std::string &name)
void apply(AddressableLight &it, const ESPColor &current_color)
void set_speed(uint32_t speed)
void set_width(uint32_t width)

Protected Attributes

uint32_t speed_ = {10}
uint16_t width_ = {50}
class AddressableRandomTwinkleEffect : public light::AddressableLightEffect

Public Functions

AddressableRandomTwinkleEffect(const std::string &name)
void apply(AddressableLight &it, const ESPColor &current_color)
void set_twinkle_probability(float twinkle_probability)
void set_progress_interval(uint32_t progress_interval)

Protected Attributes

float twinkle_probability_ = {0.05f}
uint32_t progress_interval_ = {32}
uint32_t last_progress_ = {0}
class AddressableScanEffect : public light::AddressableLightEffect

Public Functions

AddressableScanEffect(const std::string &name)
void set_move_interval(uint32_t move_interval)
void apply(AddressableLight &addressable, const ESPColor &current_color)

Protected Attributes

uint32_t move_interval_ = {100}
uint32_t last_move_ = {0}
int at_led_ = {0}
bool direction_ = {true}
class AddressableTwinkleEffect : public light::AddressableLightEffect

Public Functions

AddressableTwinkleEffect(const std::string &name)
void apply(AddressableLight &addressable, const ESPColor &current_color)
void set_twinkle_probability(float twinkle_probability)
void set_progress_interval(uint32_t progress_interval)

Protected Attributes

float twinkle_probability_ = {0.05f}
uint32_t progress_interval_ = {4}
uint32_t last_progress_ = {0}