Skip to content

Commit

Permalink
Removed Wire.endTransmission() for Arduino >1
Browse files Browse the repository at this point in the history
Wire.requestFrom() will already send a STOP thus releasing the bus. (I also tried to keep the bus, so reads greater than the TWI/Wire buffer size would be simpler to write, but that didn't work yet.)

The removed Wire.endTransmission() started a new transmission by sending a START + ADDRESS and would send a STOP after receiving ACK. Without it you'll save a few microseconds.

readBytes() tested with the MPU-6050 DMP example on UNO using Arduino IDEs 1.0.1, 1.0.5 and 1.5.2.
readWords() tested with a simple demo for UNO reading values from another Arduino. IDE 1.5.2 was used.
  • Loading branch information
snoeg committed Aug 19, 2013
1 parent 5709db6 commit 59a91a3
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions Arduino/I2Cdev/I2Cdev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8
if (count + 1 < length) Serial.print(" ");
#endif
}

Wire.endTransmission();
}
#endif

Expand Down Expand Up @@ -451,8 +449,6 @@ int8_t I2Cdev::readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint1
}
msb = !msb;
}

Wire.endTransmission();
}
#endif

Expand Down

0 comments on commit 59a91a3

Please sign in to comment.