6 namespace m5stack_8angle {
8 static const char *
const TAG =
"m5stack_8angle.light";
12 this->
buf_ = allocator.
allocate(M5STACK_8ANGLE_NUM_LEDS * M5STACK_8ANGLE_BYTES_PER_LED);
13 if (this->
buf_ ==
nullptr) {
14 ESP_LOGE(TAG,
"Failed to allocate buffer of size %u", M5STACK_8ANGLE_NUM_LEDS * M5STACK_8ANGLE_BYTES_PER_LED);
18 memset(this->
buf_, 0xFF, M5STACK_8ANGLE_NUM_LEDS * M5STACK_8ANGLE_BYTES_PER_LED);
22 ESP_LOGE(TAG,
"Failed to allocate effect data of size %u", M5STACK_8ANGLE_NUM_LEDS);
26 memset(this->
effect_data_, 0x00, M5STACK_8ANGLE_NUM_LEDS);
30 for (
int i = 0; i < M5STACK_8ANGLE_NUM_LEDS;
32 this->
parent_->write_register(M5STACK_8ANGLE_REGISTER_RGB_24B + i * M5STACK_8ANGLE_BYTES_PER_LED,
33 this->
buf_ + i * M5STACK_8ANGLE_BYTES_PER_LED, M5STACK_8ANGLE_BYTES_PER_LED);
38 size_t pos = index * M5STACK_8ANGLE_BYTES_PER_LED;
40 return {this->
buf_ + pos, this->
buf_ + pos + 1, this->
buf_ + pos + 2,
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
void write_state(light::LightState *state) override
M5Stack8AngleComponent * parent_
light::ESPColorView get_view_internal(int32_t index) const override
ESPColorCorrection correction_
virtual void mark_failed()
Mark this component as failed.
Implementation of SPI Controller mode.
An STL allocator that uses SPI or internal RAM.