GROVE LEDバーのライブラリ
Diff: LEDBar.h
- Revision:
- 0:a2b97475d3af
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LEDBar.h Sat Nov 30 03:04:10 2013 +0000 @@ -0,0 +1,36 @@ +#ifndef LED_Bar_H +#define LED_Bar_H +#include "mbed.h" + +#if 0 +#define DDR_Data DDRB +#define DDR_Clk DDRB +#define PORT_Data PORTB +#define PORT_Clk PORTB + +#define BIT_Data 0x01 +#define BIT_Clk 0x02 +#endif + +#define CmdMode 0x0000 //Work on 8-bit mode +#define ON 0x00ff //8-bit 1 data +#define SHUT 0x0000 //8-bit 0 data + +class LED_Bar +{ + public: + LED_Bar(PinName clk_pin, PinName data_pin); + void set_LED_Index(unsigned int index); + void set_LED_Index(unsigned int index1,unsigned int index2); + void set_LED_Range(unsigned int indexTo); + void set_LED_Range(unsigned int indexTo1,unsigned int indexTo2); + + private: + DigitalOut _clk_pin; + DigitalOut _data_pin; + void send16bitData(unsigned int data); + void latchData(void); + int _clk; + int _dat; +}; +#endif; \ No newline at end of file