musicmouse/espmusicmouse/lib/leds/LedControl.h

37 lines
657 B
C++

#pragma once
#include "esp32_digital_led_lib.h"
struct ColorRGB
{
uint8_t r, g, b;
};
struct ColorHSV
{
uint8_t h, s, v;
};
class LedStrip
{
public:
LedStrip(int numLeds, int pin);
void begin();
void setColor(int led, int r, int g, int b, int w);
void setColor(int led, const ColorRGB &color);
void setColor(int led, const ColorHSV &color);
void transmit();
void clear();
void setAll(int r, int g, int b, int w);
void setRange(int begin, int end, int r, int g, int b, int w);
int numLeds() const { return numLeds_; }
int normalizeLedIdx(int i);
private:
strand_t cfg;
strand_t *strands[1];
int numLeds_;
int pin_;
};