Skip to content

Commit 9de609c

Browse files
authored
Merge pull request #6 from LeeLeahy2/no-restart
Don't send I2C restart
2 parents 63b1b18 + 24a573d commit 9de609c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: src/qwiic_i2c.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,15 @@ 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(nRemaining <= 0))
153+
if (m_i2cPort->endTransmission(nRemaining <= 0))
154+
#endif
150155
return -1; // the client didn't ACK
151156
}
152157

153158
return length - nRemaining;
154-
}
159+
}

0 commit comments

Comments
 (0)