4.22. I2C Module
4.22.1. Module Files
4.22.2. Detailed Description
The driver consists of READ functions and WRITE functions. In all cases,
slaveAddress
are the seven bits of the I2C slave address.
There are two cases for READ:
I2C_Read()
: implements the usual way of reading. First a write operation is made after the START condition, to write the address (readAddress
) to read from. Then a REPEATED START condition issued on the bus andnrBytes
are read. The result is stored in the data pointed byreadData
.I2C_ReadDirect()
: a START condition is issued on the bus andnrBytes
are read directly. The result is stored in the data pointed byreadData
.
Similarly, there are two cases for WRITE:
I2C_WriteDirect()
: a START condition is issued on the bus andnrBytes
are written directly. The data to be written is pointed bywriteData
.I2C_Write()
: like the preceding function, a START condition is issued on the bus and bytes are written. The difference is thatnrBytes+1
are written: firstwriteAddress
is written, then the data to be written pointed bywriteData
. This function is symmetric toI2C_Read()
, where first the register address to access is written.
Two DMA functions are also implemented, similar to the functions where
the register address is written first before read or write.
dmaGroupANotification()
is called after the bytes are written to or
read from I2C to deactivate the corresponding DMA transfers.
Currently the DMA functions lack transaction control: in case the I2C
transaction does not finish or take place, this is not signaled to the
driver.