14.3.2.2.1 Software Design Flow
I2C Slave Mode
The I2C instance I2C_0 can be initialized by using the MSS_I2C_init API. The slave device address should be specified while initializing.
Write Operation
Following are the steps to complete the write transaction:
- Set the slave receive buffer
The data receive buffer is used to store the data received when the I2C slave is the target of an I2C write transaction. Use the MSS_I2C_set_slave_rx_buffer API.
- Register the write handler
The handler function must be called on completion of the I2C write transaction. MSS_I2C_register_write_handler API can be used to register the write handler function.
- Enable the slave
The MSS_I2C_enable_slave API can be used to enable the slave.
Read Operation
Following are the steps to complete the read transaction:
- Set the slave transmit buffer
The data buffer is transmitted when the I2C slave is the target of an I2C read transaction. Here, use the MSS_I2C_set_slave_tx_buffer API.
- Enable the slave
MSS_I2C_enable_slave API can be used to enable the slave.