forked from xiaozhi/xiaozhi-esp32
add IoT led control to kevin c3
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#define DEFAULT_BRIGHTNESS 32
|
||||
#define LOW_BRIGHTNESS 4
|
||||
|
||||
struct StripColor {
|
||||
uint8_t red = 0, green = 0, blue = 0;
|
||||
};
|
||||
@@ -19,6 +22,12 @@ public:
|
||||
virtual ~CircularStrip();
|
||||
|
||||
void OnStateChanged() override;
|
||||
void SetBrightness(uint8_t default_brightness, uint8_t low_brightness);
|
||||
void SetAllColor(StripColor color);
|
||||
void SetSingleColor(uint8_t index, StripColor color);
|
||||
void Blink(StripColor color, int interval_ms);
|
||||
void Breathe(StripColor low, StripColor high, int interval_ms);
|
||||
void Scroll(StripColor low, StripColor high, int length, int interval_ms);
|
||||
|
||||
private:
|
||||
std::mutex mutex_;
|
||||
@@ -31,13 +40,11 @@ private:
|
||||
esp_timer_handle_t strip_timer_ = nullptr;
|
||||
std::function<void()> strip_callback_ = nullptr;
|
||||
|
||||
void StartStripTask(int interval_ms, std::function<void()> cb);
|
||||
uint8_t default_brightness_ = DEFAULT_BRIGHTNESS;
|
||||
uint8_t low_brightness_ = LOW_BRIGHTNESS;
|
||||
|
||||
void StaticColor(StripColor color);
|
||||
void Blink(StripColor color, int interval_ms);
|
||||
void Breathe(StripColor low, StripColor high, int interval_ms);
|
||||
void StartStripTask(int interval_ms, std::function<void()> cb);
|
||||
void Rainbow(StripColor low, StripColor high, int interval_ms);
|
||||
void Scroll(StripColor low, StripColor high, int length, int interval_ms);
|
||||
void FadeOut(int interval_ms);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user