Skip to content

Commit 496a200

Browse files
committed
fix(Wire): only recover bus when device is master
1 parent 1e7007c commit 496a200

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/Wire/src/Wire.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ void TwoWire::begin(uint8_t address, bool generalCall, bool NoStretchMode)
9090

9191
_i2c.NoStretchMode = (NoStretchMode == true) ? 1 : 0;
9292

93-
recoverBus(); // in case I2C bus (device) is stuck after a reset for example
93+
if (_i2c.isMaster == 1) {
94+
recoverBus(); // in case I2C bus (device) is stuck after a reset for example
95+
}
9496

9597
i2c_init(&_i2c, 100000, ownAddress);
9698

0 commit comments

Comments
 (0)