1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-29 00:11:16 +01:00

samd21: i2c: clear timeout_counter

If not cleared, long writes timeout incorrectly
This commit is contained in:
Michael Andersen 2016-09-07 18:21:38 -07:00 committed by GitHub
parent 379560752c
commit 082d8e85a9

View File

@ -447,6 +447,7 @@ static inline int _write(SercomI2cm *dev, char *data, int length)
dev->DATA.reg = data[buffer_counter++];
DEBUG("Wait for response.\n");
timeout_counter = 0;
while (!(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_MB)
&& !(dev->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB)) {
if (++timeout_counter >= SAMD21_I2C_TIMEOUT) {