diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index c958881ef..0efbf680b 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -67,6 +67,14 @@ void arduino::MbedI2C::beginTransmission(uint8_t address) { } uint8_t arduino::MbedI2C::endTransmission(bool stopBit) { + #ifndef TARGET_PORTENTA_H7 + if (usedTxBuffer == 0) { + // we are scanning, return 0 if the addresed device responds with an ACK + char buf[1]; + int ret = master->read(_address, buf, 1, !stopBit); + return ret; + } + #endif if (master->write(_address, (const char *) txBuffer, usedTxBuffer, !stopBit) == 0) return 0; return 2; }