MSS
/
testI2C
Simple I2C test program. open/close/read/write supported.
dumb_i2c.h
- Committer:
- Rhyme
- Date:
- 2016-04-05
- Revision:
- 1:e105ceaee6ac
- Parent:
- 0:1a2637f8e2dd
- Child:
- 2:218e22a54982
File content as of revision 1:e105ceaee6ac:
#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(); void frequency(uint32_t f) ; uint32_t frequency(void) ; 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; uint32_t freq ; void readRegs(int addr, uint8_t * data, int len); void writeRegs(uint8_t * data, int len); }; #endif /* _DUMB_I2C_H_ */