-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLedStrip.h
47 lines (38 loc) · 967 Bytes
/
LedStrip.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
#pragma once
#include "Namespace.h"
#include "Config.h"
#include "Color.h"
LED_CONTROLLER_NAMESPACE_ENTER
/**
* Manages the colors of an addressable LED strip.
*
* The size of the strip is defined by STRIP_LENGTH.
*/
class LedStrip {
private:
Color colors[STRIP_LENGTH];
const int dataPin;
const int clockPin;
const bool reverse;
public:
LedStrip(int dataPin, int clockPin, bool reverse=false);
/** Set the pin modes. */
void setup();
/** Clear all the Colors. */
void clear();
/**
* Send all the Colors.
*
* This has all the Colors in the internal array send their
* bits, and then pauses with clockPin low for an additional
* 500 microseconds, causing the WS2081 ICs to switch from
* passing values along to showing colors.
*/
void send();
/**
* Get the internal color array, so others can adjust it.
* The array is of size STRIP_LENGTH.
*/
Color* getColors();
};
LED_CONTROLLER_NAMESPACE_EXIT