Chris Seto
/
MPU6050-DMP-4
MPU6050 issues
Fork of MPU6050 by
Diff: I2Cdev.cpp
- Revision:
- 6:6300d9561dfd
- Parent:
- 2:f8bfb37b2e1f
diff -r 7d1bf3ce0053 -r 6300d9561dfd I2Cdev.cpp --- a/I2Cdev.cpp Sat Nov 23 16:47:00 2013 +0000 +++ b/I2Cdev.cpp Tue Jul 01 16:56:00 2014 +0000 @@ -7,12 +7,12 @@ #define useDebugSerial -I2Cdev::I2Cdev(): i2c(I2C_SDA,I2C_SCL), debugSerial(USBTX, USBRX) +I2Cdev::I2Cdev(): i2c(I2C_SDA,I2C_SCL) { } -I2Cdev::I2Cdev(PinName i2cSda, PinName i2cScl): i2c(i2cSda,i2cScl), debugSerial(USBTX, USBRX) +I2Cdev::I2Cdev(PinName i2cSda, PinName i2cScl): i2c(i2cSda,i2cScl) { } @@ -40,8 +40,9 @@ * @param timeout Optional read timeout in milliseconds (0 to disable, leave off to use default class value in I2Cdev::readTimeout) * @return Status of read operation (true = success) */ -int8_t I2Cdev::readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout) { - uint16_t b; +int8_t I2Cdev::readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout) +{ + uint16_t b = 0; uint8_t count = readWord(devAddr, regAddr, &b, timeout); *data = b & (1 << bitNum); return count;