mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #11141 from maciejbocianski/i2c_Xpresso_byte_read_fix
freescale: fix i2c_byte_read functionpull/11104/head
commit
1e4a837add
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue