Simple I2C test program. open/close/read/write supported.

Dependencies:   mbed vt100

dumb_i2c.h

Committer:
Rhyme
Date:
2016-02-09
Revision:
0:1a2637f8e2dd
Child:
1:e105ceaee6ac

File content as of revision 0:1a2637f8e2dd:

#ifndef _DUMB_I2C_H_
#define _DUMB_I2C_H_

class DUMB_I2C
{
public:
  /**
  * DUMB_I2C constructor
  *
  * @param sda SDA pin
  * @param sdl SCL pin
  * @param addr addr of the I2C peripheral
  */
  DUMB_I2C(PinName sda, PinName scl, int addr);

  /**
  * HIH6130 destructor
  */
  ~DUMB_I2C();
  
  uint8_t address(void) ;
  void read(int addr, uint8_t *data, int len) ;
  void write(int addr, uint8_t *data, int len) ;
private:
  I2C m_i2c;
  int m_addr;
  void readRegs(int addr, uint8_t * data, int len);
  void writeRegs(uint8_t * data, int len);
};

#endif /* _DUMB_I2C_H_ */