Skip to content

Commit

Permalink
i2c bus scan workaround
Browse files Browse the repository at this point in the history
-sends a byte of value 0 when doing an i2c bus scan
  • Loading branch information
bigdinotech committed Feb 26, 2016
1 parent f6d8aa8 commit 582d033
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions libraries/Wire/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ uint8_t TwoWire::endTransmission(uint8_t sendStop)
if (txBufferLength >= 1) {
err = i2c_writebytes(txBuffer, txBufferLength, !sendStop);
} else {
/* FIXME: A zero byte transmit is typically used to check for an
* ACK from the slave device. This is currently not supported by
* this library implementation
*/
return 4; // Other error
//Workaround: I2C bus scan is currently implemented by sending an extra byte of value 0
txBuffer[0] = 0;
err = i2c_writebytes(txBuffer, 1, !sendStop);
}
// empty buffer
txBufferLength = 0;
Expand Down

0 comments on commit 582d033

Please sign in to comment.