Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/i2c_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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;
}

Expand Down