4 namespace spi_led_strip {
11 if (this->
buf_ ==
nullptr) {
12 ESP_LOGE(TAG,
"Failed to allocate buffer of size %u", this->
buffer_size_);
18 ESP_LOGE(TAG,
"Failed to allocate effect data of size %u", num_leds);
22 memset(this->
buf_, 0, 4);
37 esph_log_config(TAG,
"SPI LED Strip:");
38 esph_log_config(TAG,
" LEDs: %d", this->
num_leds_);
40 esph_log_config(TAG,
" Data rate: %uMHz", (
unsigned) (this->
data_rate_ / 1000000));
42 esph_log_config(TAG,
" Data rate: %ukHz", (
unsigned) (this->
data_rate_ / 1000));
48 if (ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE) {
50 size_t len = std::min(this->
buffer_size_, (
size_t) (
sizeof(strbuf) - 1) / 3);
51 memset(strbuf, 0,
sizeof(strbuf));
52 for (
size_t i = 0; i !=
len; i++) {
53 sprintf(strbuf + i * 3,
"%02X ", this->
buf_[i]);
55 esph_log_v(TAG,
"write_state: buf = %s", strbuf);
62 size_t pos = index * 4 + 5;
63 return {this->
buf_ + pos + 2, this->
buf_ + pos + 1, this->
buf_ + pos + 0,
nullptr,
void write_state(light::LightState *state) override
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
void spi_setup() override
light::LightTraits get_traits() override
SpiLedStrip(uint16_t num_leds)
This class is used to represent the capabilities of a light.
light::ESPColorView get_view_internal(int32_t index) const override
ESPColorCorrection correction_
virtual void mark_failed()
Mark this component as failed.
void write_array(const uint8_t *data, size_t length)
Implementation of SPI Controller mode.
void dump_config() override
Color can be controlled using RGB format (includes a brightness control for the color).
An STL allocator that uses SPI or internal RAM.