ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
m5stack_8angle_light.h
Go to the documentation of this file.
1#pragma once
2
5
6#include "../m5stack_8angle.h"
7
9
10static const uint8_t M5STACK_8ANGLE_NUM_LEDS = 9;
11static const uint8_t M5STACK_8ANGLE_BYTES_PER_LED = 4;
12
13class M5Stack8AngleLightOutput final : public light::AddressableLight, public Parented<M5Stack8AngleComponent> {
14 public:
17 &this->correction_) {
18 memset(this->color_data_, 0xFF, M5STACK_8ANGLE_NUM_LEDS * M5STACK_8ANGLE_BYTES_PER_LED);
19 this->accessor_ = &this->internal_accessor_;
20 }
21
22 void write_state(light::LightState *state) override;
23
24 int32_t size() const override { return M5STACK_8ANGLE_NUM_LEDS; }
26 auto traits = light::LightTraits();
27 traits.set_supported_color_modes({light::ColorMode::RGB});
28 return traits;
29 };
30
31 void clear_effect_data() override { this->internal_accessor_.clear_effect_data(M5STACK_8ANGLE_NUM_LEDS); }
32
33 protected:
34 uint8_t color_data_[M5STACK_8ANGLE_NUM_LEDS * M5STACK_8ANGLE_BYTES_PER_LED];
35 uint8_t effect_data_[M5STACK_8ANGLE_NUM_LEDS] = {};
37};
38
39} // namespace esphome::m5stack_8angle
Helper class to easily give an object a parent of type T.
Definition helpers.h:2160
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
light::CorrectedBufferColorAccessor internal_accessor_
void write_state(light::LightState *state) override
uint8_t color_data_[M5STACK_8ANGLE_NUM_LEDS *M5STACK_8ANGLE_BYTES_PER_LED]
bool state
Definition fan.h:2
@ RGB
RGB color output.
static constexpr uint8_t RESERVED_WHITE
Value of w for an RGB LED strip that uses 4 bytes per led where the 4th byte is reserved.