freescale: fix i2c_byte_read function

pull/11141/head
Maciej Bocianski 2019-07-31 19:44:23 +02:00
parent 417a9fe2fb
commit b788541308
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;
}