ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
spi_led_strip.h
Go to the documentation of this file.
1#pragma once
2
4#include "esphome/core/log.h"
7
9
10static const char *const TAG = "spi_led_strip";
12 public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
13 spi::DATA_RATE_1MHZ> {
14 public:
15 SpiLedStrip(uint16_t num_leds);
16 void setup() override;
17 float get_setup_priority() const override { return setup_priority::IO; }
18
19 int32_t size() const override { return this->num_leds_; }
20
22
23 void dump_config() override;
24
25 void write_state(light::LightState *state) override;
26
27 void clear_effect_data() override { memset(this->effect_data_, 0, this->num_leds_ * sizeof(this->effect_data_[0])); }
28
29 protected:
30 light::ESPColorView get_view_internal(int32_t index) const override;
31
32 size_t buffer_size_{};
33 uint8_t *effect_data_{nullptr};
34 uint8_t *buf_{nullptr};
35 uint16_t num_leds_;
36};
37
38} // namespace esphome::spi_led_strip
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:93
This class is used to represent the capabilities of a light.
Definition light_traits.h:9
The SPIDevice is what components using the SPI will create.
Definition spi.h:429
float get_setup_priority() const override
light::LightTraits get_traits() override
int32_t size() const override
void write_state(light::LightState *state) override
light::ESPColorView get_view_internal(int32_t index) const override
bool state
Definition fan.h:2
constexpr float IO
For components that represent GPIO pins like PCF8573.
Definition component.h:39
const char *const TAG
Definition spi.cpp:7