Merge pull request #11141 from maciejbocianski/i2c_Xpresso_byte_read_fix

freescale: fix i2c_byte_read function
pull/11104/head
Seppo Takalo 2019-08-06 11:32:24 +03:00 committed by GitHub
commit 1e4a837add
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -192,10 +192,8 @@ int i2c_byte_read(i2c_t *obj, int last)
base->C1 |= I2C_C1_TXAK_MASK; // NACK
}
data = (base->D & 0xFF);
/* Change direction to Tx to avoid extra clocks. */
base->C1 |= I2C_C1_TX_MASK;
/* Read dummy to release the bus. */
data = base->D;
/* Wait until data transfer complete. */
while (!(base->S & kI2C_IntPendingFlag))
@ -205,6 +203,11 @@ int i2c_byte_read(i2c_t *obj, int last)
/* Clear the IICIF flag. */
base->S = kI2C_IntPendingFlag;
/* Change direction to Tx to avoid extra clocks. */
base->C1 |= I2C_C1_TX_MASK;
data = (base->D & 0xFF);
return data;
}