GROVE LEDバーのライブラリ

LEDBar.h

Committer:
jksoft
Date:
2013-11-30
Revision:
0:a2b97475d3af

File content as of revision 0:a2b97475d3af:

#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;