Skip to content

Commit 582d033

Browse files
committed
i2c bus scan workaround
-sends a byte of value 0 when doing an i2c bus scan
1 parent f6d8aa8 commit 582d033

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

libraries/Wire/Wire.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,9 @@ uint8_t TwoWire::endTransmission(uint8_t sendStop)
110110
if (txBufferLength >= 1) {
111111
err = i2c_writebytes(txBuffer, txBufferLength, !sendStop);
112112
} else {
113-
/* FIXME: A zero byte transmit is typically used to check for an
114-
* ACK from the slave device. This is currently not supported by
115-
* this library implementation
116-
*/
117-
return 4; // Other error
113+
//Workaround: I2C bus scan is currently implemented by sending an extra byte of value 0
114+
txBuffer[0] = 0;
115+
err = i2c_writebytes(txBuffer, 1, !sendStop);
118116
}
119117
// empty buffer
120118
txBufferLength = 0;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy