GROVE LEDバーのライブラリ
LEDBar.h@0:a2b97475d3af, 2013-11-30 (annotated)
- Committer:
- jksoft
- Date:
- Sat Nov 30 03:04:10 2013 +0000
- Revision:
- 0:a2b97475d3af
Rev1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:a2b97475d3af | 1 | #ifndef LED_Bar_H |
jksoft | 0:a2b97475d3af | 2 | #define LED_Bar_H |
jksoft | 0:a2b97475d3af | 3 | #include "mbed.h" |
jksoft | 0:a2b97475d3af | 4 | |
jksoft | 0:a2b97475d3af | 5 | #if 0 |
jksoft | 0:a2b97475d3af | 6 | #define DDR_Data DDRB |
jksoft | 0:a2b97475d3af | 7 | #define DDR_Clk DDRB |
jksoft | 0:a2b97475d3af | 8 | #define PORT_Data PORTB |
jksoft | 0:a2b97475d3af | 9 | #define PORT_Clk PORTB |
jksoft | 0:a2b97475d3af | 10 | |
jksoft | 0:a2b97475d3af | 11 | #define BIT_Data 0x01 |
jksoft | 0:a2b97475d3af | 12 | #define BIT_Clk 0x02 |
jksoft | 0:a2b97475d3af | 13 | #endif |
jksoft | 0:a2b97475d3af | 14 | |
jksoft | 0:a2b97475d3af | 15 | #define CmdMode 0x0000 //Work on 8-bit mode |
jksoft | 0:a2b97475d3af | 16 | #define ON 0x00ff //8-bit 1 data |
jksoft | 0:a2b97475d3af | 17 | #define SHUT 0x0000 //8-bit 0 data |
jksoft | 0:a2b97475d3af | 18 | |
jksoft | 0:a2b97475d3af | 19 | class LED_Bar |
jksoft | 0:a2b97475d3af | 20 | { |
jksoft | 0:a2b97475d3af | 21 | public: |
jksoft | 0:a2b97475d3af | 22 | LED_Bar(PinName clk_pin, PinName data_pin); |
jksoft | 0:a2b97475d3af | 23 | void set_LED_Index(unsigned int index); |
jksoft | 0:a2b97475d3af | 24 | void set_LED_Index(unsigned int index1,unsigned int index2); |
jksoft | 0:a2b97475d3af | 25 | void set_LED_Range(unsigned int indexTo); |
jksoft | 0:a2b97475d3af | 26 | void set_LED_Range(unsigned int indexTo1,unsigned int indexTo2); |
jksoft | 0:a2b97475d3af | 27 | |
jksoft | 0:a2b97475d3af | 28 | private: |
jksoft | 0:a2b97475d3af | 29 | DigitalOut _clk_pin; |
jksoft | 0:a2b97475d3af | 30 | DigitalOut _data_pin; |
jksoft | 0:a2b97475d3af | 31 | void send16bitData(unsigned int data); |
jksoft | 0:a2b97475d3af | 32 | void latchData(void); |
jksoft | 0:a2b97475d3af | 33 | int _clk; |
jksoft | 0:a2b97475d3af | 34 | int _dat; |
jksoft | 0:a2b97475d3af | 35 | }; |
jksoft | 0:a2b97475d3af | 36 | #endif; |