2021-11-16 22:04:22 +01:00
|
|
|
#pragma once
|
2021-10-27 16:40:18 +02:00
|
|
|
#include "esp32_digital_led_lib.h"
|
|
|
|
|
2021-11-16 22:04:22 +01:00
|
|
|
struct ColorRGB
|
|
|
|
{
|
|
|
|
uint8_t r, g, b;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ColorHSV
|
|
|
|
{
|
|
|
|
uint8_t h, s, v;
|
|
|
|
};
|
2021-10-27 16:40:18 +02:00
|
|
|
|
|
|
|
class LedStrip
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LedStrip(int numLeds, int pin);
|
|
|
|
|
|
|
|
void begin();
|
|
|
|
|
|
|
|
void setColor(int led, int r, int g, int b, int w);
|
2021-11-16 22:04:22 +01:00
|
|
|
void setColor(int led, const ColorRGB &color);
|
|
|
|
void setColor(int led, const ColorHSV &color);
|
2021-10-27 16:40:18 +02:00
|
|
|
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_; }
|
2021-11-16 22:04:22 +01:00
|
|
|
|
|
|
|
int normalizeLedIdx(int i);
|
|
|
|
|
2021-10-27 16:40:18 +02:00
|
|
|
private:
|
|
|
|
strand_t cfg;
|
|
|
|
strand_t *strands[1];
|
|
|
|
int numLeds_;
|
|
|
|
int pin_;
|
|
|
|
};
|