Skip to content

Commit 24a573d

Browse files
committed
Add platform gate for ESP32
1 parent b1675a1 commit 24a573d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: src/qwiic_i2c.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,13 @@ int QwI2C::writeRegisterRegion(uint8_t i2c_address, uint8_t offset, uint8_t* dat
145145
nRemaining -= nToWrite; // Note - use nToWrite, not nSent, or lock on esp32
146146
data += nSent; // move up to remaining data in buffer
147147

148+
#if defined(ARDUINO_ARCH_ESP32)
149+
// if we are on ESP32, release bus no matter what
150+
if (m_i2cPort->endTransmission())
151+
#else
148152
// only release bus if we've sent all data
149-
if (m_i2cPort->endTransmission())
153+
if (m_i2cPort->endTransmission(nRemaining <= 0))
154+
#endif
150155
return -1; // the client didn't ACK
151156
}
152157

0 commit comments

Comments
 (0)