A helper class for I2C

Dependents:   MPU9150

Committer:
ethanharstad
Date:
Sat Jun 07 20:46:05 2014 +0000
Revision:
0:e0f604f504c4
Child:
1:e1b13a0c1987
API skeleton

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ethanharstad 0:e0f604f504c4 1 #include "I2CHelper.h"
ethanharstad 0:e0f604f504c4 2
ethanharstad 0:e0f604f504c4 3 /* Constructors */
ethanharstad 0:e0f604f504c4 4 I2CHelper::I2CHelper() : i2c_(I2C_SDA, I2C_SCL) {}
ethanharstad 0:e0f604f504c4 5
ethanharstad 0:e0f604f504c4 6 I2CHelper::I2CHelper(PinName sda, PinName scl) : i2c_(sda, scl) {}
ethanharstad 0:e0f604f504c4 7
ethanharstad 0:e0f604f504c4 8
ethanharstad 0:e0f604f504c4 9 /* Read Functions */
ethanharstad 0:e0f604f504c4 10 bool I2CHelper::readBit(const uint8_t devAddr, const uint8_t regAddr, const uint8_t bit, uint8_t *data) {
ethanharstad 0:e0f604f504c4 11
ethanharstad 0:e0f604f504c4 12 }
ethanharstad 0:e0f604f504c4 13
ethanharstad 0:e0f604f504c4 14 bool I2CHelper::readBits(const uint8_t devAddr, const uint8_t regAddr, const uint8_t startBit, const uint8_t length, uint8_t *data) {
ethanharstad 0:e0f604f504c4 15
ethanharstad 0:e0f604f504c4 16 }
ethanharstad 0:e0f604f504c4 17
ethanharstad 0:e0f604f504c4 18 bool I2CHelper::readByte(const uint8_t devAddr, const uint8_t regAddr, uint8_t *data) {
ethanharstad 0:e0f604f504c4 19 return readBytes(devAddr, regAddr, data, 1);
ethanharstad 0:e0f604f504c4 20 }
ethanharstad 0:e0f604f504c4 21
ethanharstad 0:e0f604f504c4 22 bool I2CHelper::readBytes(const uint8_t devAddr, const uint8_t regAddr, uint8_t *data, const uint8_t length) {
ethanharstad 0:e0f604f504c4 23
ethanharstad 0:e0f604f504c4 24 }
ethanharstad 0:e0f604f504c4 25
ethanharstad 0:e0f604f504c4 26 /* Write Functions */
ethanharstad 0:e0f604f504c4 27 bool I2CHelper::writeBit(const uint8_t devAddr, const uint8_t regAddr, const uint8_t bit, const uint8_t data) {
ethanharstad 0:e0f604f504c4 28
ethanharstad 0:e0f604f504c4 29 }
ethanharstad 0:e0f604f504c4 30
ethanharstad 0:e0f604f504c4 31 bool I2CHelper::writeBits(const uint8_t devAddr, const uint8_t regAddr, const uint8_t startBit, const uint8_t length, const uint8_t data) {
ethanharstad 0:e0f604f504c4 32
ethanharstad 0:e0f604f504c4 33 }
ethanharstad 0:e0f604f504c4 34
ethanharstad 0:e0f604f504c4 35 bool I2CHelper::writeByte(const uint8_t devAddr, const uint8_t regAddr, const uint8_t data) {
ethanharstad 0:e0f604f504c4 36 return writeBytes(devAddr, regAddr, &data, 1);
ethanharstad 0:e0f604f504c4 37 }
ethanharstad 0:e0f604f504c4 38
ethanharstad 0:e0f604f504c4 39 bool I2CHelper::writeBytes(const uint8_t devAddr, const uint8_t regAddr, const uint8_t *data, const uint8_t length) {
ethanharstad 0:e0f604f504c4 40
ethanharstad 0:e0f604f504c4 41 }