Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: FreeIMU FreeIMU_external_magnetometer
Fork of MPU6050_tmp by
Diff: I2Cdev.cpp
- Revision:
- 7:95e74f827c08
- Parent:
- 1:2daa36bfe56b
- Child:
- 9:d879deb55ae1
diff -r 40ac13ef7290 -r 95e74f827c08 I2Cdev.cpp
--- a/I2Cdev.cpp Sat Jun 22 11:23:45 2013 +0000
+++ b/I2Cdev.cpp Sat Nov 02 17:23:43 2013 +0000
@@ -5,7 +5,7 @@
#include "I2Cdev.h"
-#define useDebugSerial
+//#define useDebugSerial
I2Cdev::I2Cdev(): debugSerial(USBTX, USBRX), i2c(I2C_SDA,I2C_SCL)
{
@@ -17,6 +17,11 @@
}
+I2Cdev::I2Cdev(I2C i2c_): debugSerial(USBTX, USBRX), i2c(i2c_)
+{
+
+}
+
/** Read a single bit from an 8-bit device register.
* @param devAddr I2C slave device address
* @param regAddr Register regAddr to read from
@@ -133,7 +138,7 @@
command[0] = regAddr;
char *redData = (char*)malloc(length);
i2c.write(devAddr<<1, command, 1, true);
- i2c.read(devAddr<<1, redData, length);
+ i2c.read((devAddr<<1)+1, redData, length);
for(int i =0; i < length; i++) {
data[i] = redData[i];
}
