/* In order to start the I2CEngine, the all the parameters must be set in advance, including I2CWriteLength, I2CReadLength, I2CCmd, and the I2cMasterBuffer which contains the stream command/data to the I2c slave device. (1) If it's a I2C write only, the number of bytes to be written is I2CWriteLength, I2CReadLength is zero, the content will be filled in the I2CMasterBuffer. (2) If it's a I2C read only, the number of bytes to be read is I2CReadLength, I2CWriteLength is 0, the read value will be filled in the I2CMasterBuffer. (3) If it's a I2C Write/Read with repeated start, specify the I2CWriteLength, fill the content of bytes to be written in I2CMasterBuffer, specify the I2CReadLength, after the repeated start and the device address with RD bit set, the content of the reading will be filled in I2CMasterBuffer index at I2CMasterBuffer[I2CWriteLength+2].
e.g. Start, DevAddr(W), WRByte1...WRByteN, Repeated-Start, DevAddr(R),
RDByte1...RDByteN Stop. The content of the reading will be filled after (I2CWriteLength + two devaddr) bytes. */
/* In order to start the I2CEngine, the all the parameters
must be set in advance, including I2CWriteLength, I2CReadLength,
I2CCmd, and the I2cMasterBuffer which contains the stream
command/data to the I2c slave device.
(1) If it's a I2C write only, the number of bytes to be written is
I2CWriteLength, I2CReadLength is zero, the content will be filled
in the I2CMasterBuffer.
(2) If it's a I2C read only, the number of bytes to be read is
I2CReadLength, I2CWriteLength is 0, the read value will be filled
in the I2CMasterBuffer.
(3) If it's a I2C Write/Read with repeated start, specify the
I2CWriteLength, fill the content of bytes to be written in
I2CMasterBuffer, specify the I2CReadLength, after the repeated
start and the device address with RD bit set, the content of the
reading will be filled in I2CMasterBuffer index at
I2CMasterBuffer[I2CWriteLength+2].
e.g. Start, DevAddr(W), WRByte1...WRByteN, Repeated-Start, DevAddr(R),
RDByte1...RDByteN Stop. The content of the reading will be filled
after (I2CWriteLength + two devaddr) bytes. */
/* It seems to be bit0 is for I2C, different from
UM. To be retested along with SSP reset. SSP and I2C
reset are overlapped, a known bug, for now, both SSP
and I2C use bit 0 for reset enable. Once the problem
is fixed, change to "#if 1". */
可以参考一下下面的资料:
【TinyM0配套教程】功能部件(I2C)
LPC1100用户手册(第十章)I2C接口
一周热门 更多>