ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::light::BufferColorAccessor Class Reference

Base class for color accessors backed by a buffer whose layout is described by ChannelColors. More...

#include <esp_color_view.h>

Inheritance diagram for esphome::light::BufferColorAccessor:
esphome::light::ESPColorAccessor esphome::light::CorrectedBufferColorAccessor esphome::light::RawBufferColorAccessor

Public Member Functions

 BufferColorAccessor ()=default
 
 BufferColorAccessor (uint8_t *color_data, uint8_t *effect_data, ChannelColors channel_colors)
 
Color get_raw (int32_t index) const override
 
uint8_t get_channel_raw (int32_t index, uint8_t channel) const override
 
uint8_t get_effect_data (int32_t index) const override
 
void set_raw (int32_t index, Color raw_color) override
 
void set_channel_raw (int32_t index, uint8_t channel, uint8_t raw_value) override
 
void set_effect_data (int32_t index, uint8_t value) override
 
bool allocate (RAMAllocator< uint8_t > &allocator, size_t num_leds, size_t extra_bytes=0)
 Allocate the color and effect data for num_leds LEDs as one zeroed block, followed by extra_bytes more for the caller, which start at effect_data + num_leds.
 
void clear_effect_data (size_t num_leds)
 Zero the effect data of the first num_leds LEDs; does nothing before the effect data is allocated.
 
- Public Member Functions inherited from esphome::light::ESPColorAccessor
virtual Color get (int32_t index) const =0
 
virtual uint8_t get_channel (int32_t index, uint8_t channel) const =0
 
virtual void set (int32_t index, Color color)=0
 
virtual void set_channel (int32_t index, uint8_t channel, uint8_t value)=0
 
virtual const ESPColorCorrection * get_color_correction_internal (int32_t index) const
 

Data Fields

uint8_t * color_data {nullptr}
 
uint8_t * effect_data {nullptr}
 
ChannelColors channel_colors {}
 

Detailed Description

Base class for color accessors backed by a buffer whose layout is described by ChannelColors.

Definition at line 61 of file esp_color_view.h.

Constructor & Destructor Documentation

◆ BufferColorAccessor() [1/2]

esphome::light::BufferColorAccessor::BufferColorAccessor ( )
default

◆ BufferColorAccessor() [2/2]

esphome::light::BufferColorAccessor::BufferColorAccessor ( uint8_t * color_data,
uint8_t * effect_data,
ChannelColors channel_colors )
inline

Definition at line 64 of file esp_color_view.h.

Member Function Documentation

◆ allocate()

bool esphome::light::BufferColorAccessor::allocate ( RAMAllocator< uint8_t > & allocator,
size_t num_leds,
size_t extra_bytes = 0 )
inline

Allocate the color and effect data for num_leds LEDs as one zeroed block, followed by extra_bytes more for the caller, which start at effect_data + num_leds.

Returns false if it failed.

Definition at line 83 of file esp_color_view.h.

◆ clear_effect_data()

void esphome::light::BufferColorAccessor::clear_effect_data ( size_t num_leds)
inline

Zero the effect data of the first num_leds LEDs; does nothing before the effect data is allocated.

Definition at line 96 of file esp_color_view.h.

◆ get_channel_raw()

uint8_t esphome::light::BufferColorAccessor::get_channel_raw ( int32_t index,
uint8_t channel ) const
inlineoverridevirtual

Implements esphome::light::ESPColorAccessor.

Definition at line 68 of file esp_color_view.h.

◆ get_effect_data()

uint8_t esphome::light::BufferColorAccessor::get_effect_data ( int32_t index) const
inlineoverridevirtual

Implements esphome::light::ESPColorAccessor.

Definition at line 71 of file esp_color_view.h.

◆ get_raw()

Color esphome::light::BufferColorAccessor::get_raw ( int32_t index) const
inlineoverridevirtual

Implements esphome::light::ESPColorAccessor.

Definition at line 67 of file esp_color_view.h.

◆ set_channel_raw()

void esphome::light::BufferColorAccessor::set_channel_raw ( int32_t index,
uint8_t channel,
uint8_t raw_value )
inlineoverridevirtual

Implements esphome::light::ESPColorAccessor.

Definition at line 76 of file esp_color_view.h.

◆ set_effect_data()

void esphome::light::BufferColorAccessor::set_effect_data ( int32_t index,
uint8_t value )
inlineoverridevirtual

Implements esphome::light::ESPColorAccessor.

Definition at line 79 of file esp_color_view.h.

◆ set_raw()

void esphome::light::BufferColorAccessor::set_raw ( int32_t index,
Color raw_color )
inlineoverridevirtual

Implements esphome::light::ESPColorAccessor.

Definition at line 73 of file esp_color_view.h.

Field Documentation

◆ channel_colors

ChannelColors esphome::light::BufferColorAccessor::channel_colors {}

Definition at line 104 of file esp_color_view.h.

◆ color_data

uint8_t* esphome::light::BufferColorAccessor::color_data {nullptr}

Definition at line 102 of file esp_color_view.h.

◆ effect_data

uint8_t* esphome::light::BufferColorAccessor::effect_data {nullptr}

Definition at line 103 of file esp_color_view.h.


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