To initialize the I2C controller, perform the following steps:
- Configure the I2Ci.I2C_CON register:
- For master or slave mode, set the I2Ci.I2C_CON[10] MST bit (0: slave; 1: master).
- For transmitter or receiver mode, set the I2Ci.I2C_CON[9] TRX bit (0: receiver; 1: transmitter).
- If using an interrupt to transmit and receive data, set the corresponding bit in the I2Ci.I2C_IRQENABLE_SET register to 1 (the I2Ci.I2C_IRQENABLE_SET [4] XRDY_IE bit for the transmit interrupt, the I2Ci.I2C_IRQENABLE_SET [3] RRDY bit for the receive interrupt).
- If using DMA to receive and transmit data, set the corresponding bit in the I2Ci.I2C_BUF register to 1 (the I2Ci.I2C_BUF[15] RDMA_EN bit for the receive DMA channel, the I2Ci.I2C_BUF[7] XDMA_EN bit for the transmit DMA channel).