-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathledstrip.h
More file actions
50 lines (32 loc) · 1.23 KB
/
ledstrip.h
File metadata and controls
50 lines (32 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef ledstrip_h
#define ledstrip_h
#include <Adafruit_NeoPixel.h> // NeoPixel library used to run the NeoPixel LEDs:
#include "udplogger.h"
#include "constants.h"
#define DEFAULT_CURRENT_LIMIT 9999
class LEDStrip{
public:
LEDStrip(Adafruit_NeoPixel *neopixel_leds, UDPLogger *logger);
static uint32_t Color24bit(uint8_t r, uint8_t g, uint8_t b);
static uint32_t Wheel(uint8_t WheelPos);
static uint32_t interpolateColor24bit(uint32_t color1, uint32_t color2, float factor);
void initializeStrip();
void setBrightness(uint8_t brightness);
void setCurrentLimit(uint16_t currentLimit);
uint8_t getBrightness();
void flush();
void setPixel(uint16_t pixel, uint32_t color);
void drawOnLEDsInstant();
void drawOnLEDsSmooth(float factor);
void runLEDTest();
private:
Adafruit_NeoPixel *neopixel_leds;
UDPLogger *logger;
uint16_t currentLimit;
uint8_t brightness;
uint32_t target[LED_COUNT] = {0};
uint32_t current[LED_COUNT] = {0};
void drawOnLEDs(float factor);
uint16_t calcEstimatedLEDCurrent(uint32_t color, uint8_t brightness);
};
#endif