-
Notifications
You must be signed in to change notification settings - Fork 0
/
LPD8806.h
93 lines (76 loc) · 2.87 KB
/
LPD8806.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
#ifndef LPD8806_H
#define LPD8806_H
#include <stdint.h>
#include "gnublin.h"
#include "Color.h"
#define R 0
#define G 1
#define B 2
#define BOARD RASPBERRY_PI
#define SPI_SPEED 32000000
#define CHIP_SELECT 0
#define SPI_LSB 0
#define PI 3.14159265
class LPD8806
{
public:
LPD8806(); //default constructor
LPD8806(const int&); //no. of leds argument construnctor
LPD8806(const int&, const int&); //no. of leds, channel order argument construnctor
~LPD8806(); //destructor
bool update();
bool allOff();
bool fill(const ColorRGB&, int =0, int =0);
bool fillRGB(uint8_t, uint8_t, uint8_t, int =0, int =0);
bool fillHSV(uint8_t, uint8_t, uint8_t, int =0, int =0);
bool fillHue(uint8_t, int =0, int =0);
bool fillOff(int =0, int =0);
void setRGB(int, uint8_t, uint8_t, uint8_t);
void setHSV(int, uint8_t, uint8_t, uint8_t);
void setHue(int, uint8_t);
void setOff(int);
ColorRGB wheelColor(int);
void anim_Rainbow(int =0, int =0);
void anim_RainbowCycle(int =0, int =0);
void anim_Stripe(ColorRGB, ColorRGB, int, int&, int =0, int =0);
void anim_StripeReverse(ColorRGB, ColorRGB, int, int&, int =0, int =0);
void anim_Line(ColorRGB, ColorRGB, int, int =0, int =0);
void anim_PulseSaw(ColorRGB, int =0, int =0);
void anim_PulseSine(ColorRGB, int =0, int =0);
void anim_ColorDrift(int, int, int =0, int =0);
void anim_SpeckleSingle(ColorRGB, ColorRGB, int, int =0, int =0);
void anim_SpeckleDouble(ColorRGB, ColorRGB, ColorRGB, int, int =0, int =0);
void anim_ColorWipe(ColorRGB, int =0, int =0);
void anim_ColorChase(ColorRGB, int =0, int =0);
void anim_ChaseMelting(ColorRGB, int, int =0, int =0);
void anim_WheelCycle(const int&,const int&,const int&, int =0, int =0);
void anim_LarsonScanner(ColorRGB, int =2, float =0.75, int=0, int =0);
void anim_LarsonRainbow(ColorRGB, int =2, float =0.75, int=0, int =0);
void anim_SineWave(ColorRGB, int, int=0, int =0);
void anim_StepThird(ColorRGB);
void anim_RandQuater(ColorRGB, ColorRGB, int =0, int =0);
void anim_BlockFill(ColorRGB, ColorRGB, int, int=0, int=0);
bool strobe(float, float);
void setPixel(int,const ColorRGB&);
// bool setNLeds(const int&); //set the number of leds in strip
// bool setChOrder(const int&); //set the channel order of the strip
// bool getNLeds(const int&); //get the number of leds in strip
// bool getChOrder(const int&); //get the channel order of the strip
static const uint8_t CHANNEL_ORDER[3][3];
private:
void setUp();
const uint8_t *chOrder_;
uint8_t **buffer_;
uint8_t *zeros_;
uint8_t *gamma_;
int nLeds_;
int lastIndex_;
float masterBrightness_;
gnublin_spi *spi;
int rainbowStep_, rainbowCycleStep_, larsonStep_, wipeStep_, chaseStep_, waveStep_;
int larsonDir_, larsonLast_;
int thirdStep_, stripeStep_, sineDir_, lineStep_, wheelStep_, driftStep_, driftDir_;
int blockStep_, meltStep_;
float sawStep_, sineStep_;
};
#endif