1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-10 15:10:58 +00:00
esphome/esphome/components/adalight/adalight_light_effect.h
Oxan van Leeuwen 97681d142e
Enable readability-redundant-access-specifiers check (#3096)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2022-01-23 20:47:22 +13:00

40 lines
940 B
C++

#pragma once
#include "esphome/core/component.h"
#include "esphome/components/light/addressable_light_effect.h"
#include "esphome/components/uart/uart.h"
#include <vector>
namespace esphome {
namespace adalight {
class AdalightLightEffect : public light::AddressableLightEffect, public uart::UARTDevice {
public:
AdalightLightEffect(const std::string &name);
void start() override;
void stop() override;
void apply(light::AddressableLight &it, const Color &current_color) override;
protected:
enum Frame {
INVALID,
PARTIAL,
CONSUMED,
};
unsigned int get_frame_size_(int led_count) const;
void reset_frame_(light::AddressableLight &it);
void blank_all_leds_(light::AddressableLight &it);
Frame parse_frame_(light::AddressableLight &it);
uint32_t last_ack_{0};
uint32_t last_byte_{0};
uint32_t last_reset_{0};
std::vector<uint8_t> frame_;
};
} // namespace adalight
} // namespace esphome