A helper class for I2C
Diff: I2CHelper.cpp
- Revision:
- 0:e0f604f504c4
- Child:
- 1:e1b13a0c1987
diff -r 000000000000 -r e0f604f504c4 I2CHelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/I2CHelper.cpp Sat Jun 07 20:46:05 2014 +0000 @@ -0,0 +1,41 @@ +#include "I2CHelper.h" + +/* Constructors */ +I2CHelper::I2CHelper() : i2c_(I2C_SDA, I2C_SCL) {} + +I2CHelper::I2CHelper(PinName sda, PinName scl) : i2c_(sda, scl) {} + + +/* Read Functions */ +bool I2CHelper::readBit(const uint8_t devAddr, const uint8_t regAddr, const uint8_t bit, uint8_t *data) { + +} + +bool I2CHelper::readBits(const uint8_t devAddr, const uint8_t regAddr, const uint8_t startBit, const uint8_t length, uint8_t *data) { + +} + +bool I2CHelper::readByte(const uint8_t devAddr, const uint8_t regAddr, uint8_t *data) { + return readBytes(devAddr, regAddr, data, 1); +} + +bool I2CHelper::readBytes(const uint8_t devAddr, const uint8_t regAddr, uint8_t *data, const uint8_t length) { + +} + +/* Write Functions */ +bool I2CHelper::writeBit(const uint8_t devAddr, const uint8_t regAddr, const uint8_t bit, const uint8_t data) { + +} + +bool I2CHelper::writeBits(const uint8_t devAddr, const uint8_t regAddr, const uint8_t startBit, const uint8_t length, const uint8_t data) { + +} + +bool I2CHelper::writeByte(const uint8_t devAddr, const uint8_t regAddr, const uint8_t data) { + return writeBytes(devAddr, regAddr, &data, 1); +} + +bool I2CHelper::writeBytes(const uint8_t devAddr, const uint8_t regAddr, const uint8_t *data, const uint8_t length) { + +} \ No newline at end of file