I2C sensor test program, derived from testI2C program. Simple test for FXOS8700CQ, HIH6130, MAG3110, MMA8451Q, MMA8452Q, MPL3115A2, MAX44000, MAX44005, MAX44008, MAX30101 included beside simple I2C read/write from testI2C.
Dependencies: FXOS8700CQ HIH6130 IS31SE5000 MAG3110 MAX44000 MAX44005 MAX44008 MMA8451Q MMA8452Q MPL3115A2 VEML6040 VEML6075 mbed vt100 LM75B FXAS21002 MAX30101 VCNL4020 VCNL4100
dumb_i2c.h
- Committer:
- Rhyme
- Date:
- 2017-12-27
- Revision:
- 18:ee6f43cbfcc1
- Parent:
- 0:d4bbd473a83c
File content as of revision 18:ee6f43cbfcc1:
#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 start(void) ; void stop(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_ */