-
Notifications
You must be signed in to change notification settings - Fork 14
/
LedDriverLPD8806.h
93 lines (73 loc) · 1.88 KB
/
LedDriverLPD8806.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
* LedDriverLPD8806
* Implementierung auf der Basis von LPD8806-Streifen.
*
* @mc Arduino/RBBB
* @autor Christian Aschoff / caschoff _AT_ mac _DOT_ com
* @version 1.1
* @created 9.2.2015
* @updated 16.2.2015
*
* Versionshistorie:
* V 1.0: - Erstellt.
* V 1.1: - Unterstuetzung fuer die alte Arduino-IDE (bis 1.0.6) entfernt.
*
* Verkabelung: Einspeisung oben links, dann schlangenfoermig runter,
* dann Ecke unten links, oben links, oben rechts, unten rechts.
*
* Achtung! LPD8806-Streifen koennen nur in Vielfachen von 2 getrennt werden! Daher bleiben am Rand LEDs uebrig (und dunkel)!
*
*/
#ifndef LED_DRIVER_LPD8806_H
#define LED_DRIVER_LPD8806_H
#include "Arduino.h"
#include "LedDriver.h"
#ifdef MATRIX_XXL
#ifdef RGBW_LEDS
#include <LPD8806RGBW_DBL.h>
#else
#include <LPD8806DBL.h>
#endif
#else
#ifdef RGBW_LEDS
#include <LPD8806RGBW.h>
#else
#include <LPD8806.h>
#endif
#endif
class LedDriverLPD8806 : public LedDriver {
public:
LedDriverLPD8806(byte dataPin, byte clockPin);
void init();
void printSignature();
void writeScreenBufferToMatrix(word matrix[16], boolean onChange, eColors a_color);
void setBrightness(byte brightnessInPercent);
byte getBrightness();
void setLinesToWrite(byte linesToWrite);
void shutDown();
void wakeUp();
void clearData();
private:
byte _brightnessInPercent;
boolean _dirty;
void _setPixel(byte x, byte y, uint32_t c);
void _setPixel(byte num, uint32_t c);
uint32_t _wheel(byte brightness, byte wheelPos);
void _clear();
byte _brightnessScaleColor(byte brightness, byte colorPart);
unsigned int _lastLEDsOn;
#ifdef MATRIX_XXL
#ifdef RGBW_LEDS
LPD8806RGBW_DBL *_strip;
#else
LPD8806DBL *_strip;
#endif
#else
#ifdef RGBW_LEDS
LPD8806RGBW *_strip;
#else
LPD8806 *_strip;
#endif
#endif
};
#endif