I2C Read using FX2™ and FX2LP™ - KBA85382 | Cypress Semiconductor
Support & Community
I2C Read using FX2™ and FX2LP™ - KBA85382
How is I2C read implemented in FX2 and FX2LP?
I2C read implementation is illustrated in the file i2c.c, which is available in the path \Cypress\USB\Target\Lib\LP\i2c.c.
In this file, the implementation of read occurs in the ISR. The I2C_Read function sends the Read Command and changes the I2C.PktStatus to I2C_PRIME. The I2C enters the ISR every time a byte of data is successfully transferred when the DONE bit is set High.
When the following section of code is executed for the first time, the data that has been read is stored to I2CPckt.dat and the status is changed to I2C_RECEIVING:
To read more data, the following section of the code is executed the next time the ISR is serviced: