sparkfun / SparkFun_MPU-9250-DMP_Arduino_Library

Arduino library for the MPU-9250 enabling its digital motion process (DMP) features.
Other
225 stars 152 forks source link

No Wire.endTransmission() needed after Wire.requestFrom() #1

Closed Koepel closed 7 years ago

Koepel commented 7 years ago

In the file "util/arduino_mpu9250_i2c.cpp" in the function "arduino_i2c_read()", there is a Wire.endTransmission() after the Wire.requestFrom(). The Wire.endTransmission() should only be used when writing data, since the Wire.requestFrom() is a complete I2C session on its own.

The unnecessary extra Wire.endTransmission() causes an extra I2C transaction for the AVR chips (I don't know about other Wire libraries). The Master sets the I2C address on the bus, and the MPU-9250 acknowledges that. That makes it slower.

jimblom commented 7 years ago

Thanks for catching that! Tested and working on a 9DoF Razor M0. Pushed with commit 1251c57.