MSS
/
testI2C
Simple I2C test program. open/close/read/write supported.
Diff: dumb_i2c.h
- Revision:
- 0:1a2637f8e2dd
- Child:
- 1:e105ceaee6ac
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dumb_i2c.h Tue Feb 09 00:23:22 2016 +0000 @@ -0,0 +1,31 @@ +#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_ */ \ No newline at end of file