forked from brimshot/quickPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qpLightStrand.h
47 lines (27 loc) · 902 Bytes
/
qpLightStrand.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
38
39
40
41
42
43
44
45
46
47
#ifndef QP_LIGHT_STRAND_H
#define QP_LIGHT_STRAND_H
//#include <qpLinkedList.h>
class qpLightStrand {
private:
CRGB *displayLeds;
int numLeds;
qpLinkedList <CRGB> virtualLeds;
public:
qpLightStrand(CRGB *displayLeds, int numLeds) : displayLeds(displayLeds), numLeds(numLeds) {}
int getNumLeds() { return this->numLeds; }
CRGB *getLeds() { return this->displayLeds ;}
CRGB *getVirtualLeds(byte index) {
if(index > (this->virtualLeds.numElements-1))
return this->virtualLeds.append(new CRGB[this->numLeds]);
return this->virtualLeds.getItem(index);
}
void clearMain() {
fill_solid(this->displayLeds, this->numLeds, CRGB::Black);
}
void clearAll() {
this->clearMain();
while(CRGB *currentLeds = this->virtualLeds.fetch())
fill_solid(currentLeds, this->numLeds, CRGB::Black);
}
};
#endif