-
Notifications
You must be signed in to change notification settings - Fork 2
/
LedPiper.h
50 lines (40 loc) · 1.02 KB
/
LedPiper.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
48
49
#pragma once
#include "Namespace.h"
#include "Config.h"
#include "Color.h"
#include "LedStrip.h"
#include "Arduino.h"
LED_CONTROLLER_NAMESPACE_ENTER
/**
* Manage transferral of color data from Serial (via DataReceiver) to LEDs
* (via LedStrip).
*
* See the examples/ for demo usage.
*/
class LedPiper {
private:
LedStrip ledStrip;
static void unpackColorBytes(
size_t size, const char* colorBytes, Color* colors);
public:
/**
* Initialize the internal LedStrip.
*/
LedPiper(int dataPin, int clockPin);
/**
* Call the internal LedStrip's setup; clear it and display
* the blank (all-black) state.
*/
void setup();
/**
* Read the byte array (from serial) and set the Color values
* of the LedStrip accordingly, then update the LEDs.
*/
void setColorsAndSend(size_t size, const char* colorBytes);
/**
* The expected data key which will be used for color data
* sent over Serial. (To be used with DataReceiver::addKey.)
*/
static const char* KEY;
};
LED_CONTROLLER_NAMESPACE_EXIT