amiro-os / include / amiro / leds / tlc5947.hpp @ 84b4c632
History | View | Annotate | Download (825 Bytes)
1 | 58fe0e0b | Thomas Schöpping | #ifndef AMIRO_TLC5947_H_
|
---|---|---|---|
2 | #define AMIRO_TLC5947_H_
|
||
3 | |||
4 | #include <amiro/Color.h> |
||
5 | |||
6 | namespace amiro {
|
||
7 | |||
8 | class HWSPIDriver; |
||
9 | |||
10 | class TLC5947 : public chibios_rt::BaseStaticThread<192> { |
||
11 | public:
|
||
12 | TLC5947(HWSPIDriver *spi, ioportid_t blankPort, int blankPad);
|
||
13 | virtual ~TLC5947();
|
||
14 | void disable();
|
||
15 | void enable();
|
||
16 | void setBrightness(int brightness); |
||
17 | void setColor(int index, Color color); |
||
18 | void update();
|
||
19 | |||
20 | protected:
|
||
21 | virtual msg_t main(void); |
||
22 | |||
23 | private:
|
||
24 | int caluclateRedGrayscale(Color color, int brightness) const; |
||
25 | int caluclateGreenGrayscale(Color color, int brightness) const; |
||
26 | int caluclateBlueGrayscale(Color color, int brightness) const; |
||
27 | |||
28 | HWSPIDriver *spi; |
||
29 | ioportid_t blankPort; |
||
30 | int blankPad;
|
||
31 | Color colors[8];
|
||
32 | int brightness;
|
||
33 | }; |
||
34 | |||
35 | } |
||
36 | |||
37 | #endif /* AMIRO_TLC5947_H_ */ |