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