-
Notifications
You must be signed in to change notification settings - Fork 7
/
leds.h
37 lines (33 loc) · 871 Bytes
/
leds.h
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
#pragma once
#include <FastLED.h>
namespace pixl {
/* LEDStrip represents a FastLED-compatible LED strip. */
class LEDStrip {
public:
LEDStrip(int length);
~LEDStrip();
void AssignPin(int pin);
int length;
CRGB* leds;
};
/* LEDs represents a section of an LED strip. */
class LEDs {
public:
LEDs(LEDStrip* strip, int start, int length, bool reverse = false);
LEDs(int num_strips, LEDStrip* strips[], int* starts, int* lengths,
bool reverse = false);
~LEDs();
CRGB& operator[](int index);
int length() { return length_; }
void fillSolid(CRGB color);
private:
void init(int num_strips, LEDStrip* strips[], int* starts, int* lengths,
bool reverse);
int length_;
int num_strips_;
LEDStrip** strips_;
int* starts_;
int* lengths_;
int reverse_;
};
} // end namespace pixl