ESPHome  2024.10.2
m5stack_8angle_light.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include "../m5stack_8angle.h"
7 
8 namespace esphome {
9 namespace m5stack_8angle {
10 
11 static const uint8_t M5STACK_8ANGLE_NUM_LEDS = 9;
12 static const uint8_t M5STACK_8ANGLE_BYTES_PER_LED = 4;
13 
14 class M5Stack8AngleLightOutput : public light::AddressableLight, public Parented<M5Stack8AngleComponent> {
15  public:
16  void setup() override;
17 
18  void write_state(light::LightState *state) override;
19 
20  int32_t size() const override { return M5STACK_8ANGLE_NUM_LEDS; }
22  auto traits = light::LightTraits();
23  traits.set_supported_color_modes({light::ColorMode::RGB});
24  return traits;
25  };
26 
27  void clear_effect_data() override { memset(this->effect_data_, 0x00, M5STACK_8ANGLE_NUM_LEDS); };
28 
29  protected:
30  light::ESPColorView get_view_internal(int32_t index) const override;
31 
32  uint8_t *buf_{nullptr};
33  uint8_t *effect_data_{nullptr};
34 };
35 
36 } // namespace m5stack_8angle
37 } // namespace esphome
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Definition: light_state.h:34
void write_state(light::LightState *state) override
light::ESPColorView get_view_internal(int32_t index) const override
This class is used to represent the capabilities of a light.
Definition: light_traits.h:11
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Color can be controlled using RGB format (includes a brightness control for the color).
Helper class to easily give an object a parent of type T.
Definition: helpers.h:521
bool state
Definition: fan.h:34