ESPHome 2026.11.0b6
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#include <cstring>
12
14#include "esphome/core/log.h"
17
18#include <driver/i2s_types.h>
19
21
23 public:
24 I2SClocklessLedStrip(uint8_t pin, uint16_t num_leds, light::ChannelColors channel_colors);
25
26 void dump_config() override;
27
28 float get_setup_priority() const override;
29 void setup() override;
30
32
33 int32_t size() const override { return this->num_leds_; }
35 void write_state(light::LightState *state) override;
36
37 protected:
38 static bool i2s_on_sent_callback(i2s_chan_handle_t handle, i2s_event_data_t *event, void *user_ctx);
39
40 bool allocate_buffers_();
41
43 const size_t color_data_bytes_;
44 uint8_t *i2s_data_{nullptr};
45 size_t i2s_data_sent_{0};
46 i2s_chan_handle_t tx_handle_{};
47 const uint16_t num_leds_;
48 const uint8_t pin_;
49 std::atomic<bool> i2s_data_ready_{false};
50};
51
52} // namespace esphome::i2s_clockless_led_strip
53
54#endif
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)
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.
Color accessor backed by a buffer whose contents have color correction applied.
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.
LightTraits traits() const
Colour modes of a strip with this channel order.
spi_device_handle_t handle