ESPHome 2025.5.0
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
8namespace esphome {
9namespace spi_led_strip {
10
11static const char *const TAG = "spi_led_strip";
13 public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
14 spi::DATA_RATE_1MHZ> {
15 public:
16 SpiLedStrip(uint16_t num_leds);
17 void setup() override;
18 float get_setup_priority() const override { return setup_priority::IO; }
19
20 int32_t size() const override { return this->num_leds_; }
21
23
24 void dump_config() override;
25
26 void write_state(light::LightState *state) override;
27
28 void clear_effect_data() override { memset(this->effect_data_, 0, this->num_leds_ * sizeof(this->effect_data_[0])); }
29
30 protected:
31 light::ESPColorView get_view_internal(int32_t index) const override;
32
33 size_t buffer_size_{};
34 uint8_t *effect_data_{nullptr};
35 uint8_t *buf_{nullptr};
36 uint16_t num_leds_;
37};
38
39} // namespace spi_led_strip
40} // namespace esphome
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:63
This class is used to represent the capabilities of a light.
The SPIDevice is what components using the SPI will create.
Definition spi.h:421
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:0
const float IO
For components that represent GPIO pins like PCF8573.
Definition component.cpp:17
const char *const TAG
Definition spi.cpp:8
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7