ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
i2s_clockless_led_strip.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef USE_ESP32
4#include <soc/soc_caps.h>
5#endif
6
7#if defined(USE_ESP32) && SOC_I2S_SUPPORTS_TDM
8
9#include <atomic>
10#include <cstdint>
11
13#include "esphome/core/log.h"
16
17#include <driver/i2s_types.h>
18
20
22 public:
23 I2SClocklessLedStrip(uint8_t pin, uint16_t num_leds, light::ChannelColors channel_colors);
24
25 void dump_config() override;
26
27 float get_setup_priority() const override;
28 void setup() override;
29
31
32 int32_t size() const override { return this->num_leds_; }
33 void clear_effect_data() override;
34 void write_state(light::LightState *state) override;
35
36 protected:
37 static bool i2s_on_sent_callback(i2s_chan_handle_t handle, i2s_event_data_t *event, void *user_ctx);
38
39 bool allocate_buffers_();
40 light::ESPColorView get_view_internal(int32_t index) const override;
41
42 const size_t color_data_bytes_;
43 uint8_t *effect_data_{nullptr};
44 uint8_t *color_data_{nullptr};
45 uint8_t *i2s_data_{nullptr};
46 size_t i2s_data_sent_{0};
47 i2s_chan_handle_t tx_handle_{};
49 const uint16_t num_leds_;
50 const uint8_t pin_;
51 std::atomic<bool> i2s_data_ready_{false};
52};
53
54} // namespace esphome::i2s_clockless_led_strip
55
56#endif
light::ESPColorView get_view_internal(int32_t index) const override
I2SClocklessLedStrip(uint8_t pin, uint16_t num_leds, light::ChannelColors channel_colors)
static bool i2s_on_sent_callback(i2s_chan_handle_t handle, i2s_event_data_t *event, void *user_ctx)
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition light_state.h:68
This class is used to represent the capabilities of a light.
Definition light_traits.h:9
bool state
Definition fan.h:2
Which byte of an addressable LED's data carries each colour.
spi_device_handle_t handle