Ported from Arduino Library : https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050
Dependents:
mpu6050_test
testI2C
Hobby_Humanoid_controlor
mpu6050_test
... more
1 comment:
I should use Mr. Kodewitz's version, but I used Mr. Gaertig's original, found a bug in the i2cdev code.
After fixing this bug, the library works very well.
a bug in the I2Cdev, memory leak
int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout)
{
char command[1];
command[0] = regAddr;
char *redData = (char*)malloc(length);
i2c.write(devAddr<<1, command, 1, true);
i2c.read(devAddr<<1, redData, length);
for(int i =0; i < length; i++) {
data[i] = redData[i];
}
/////////////////////////////////////////////////////////////
free(redData); // Y.Kuroda Jun.20,2013
/////////////////////////////////////////////////////////////
return length;
}
I should use Mr. Kodewitz's version, but I used Mr. Gaertig's original, found a bug in the i2cdev code. After fixing this bug, the library works very well.
a bug in the I2Cdev, memory leak