最近在调试STM32F030单片机的I2C总线,现在虽然参考官方实例调试成功了 但是有一些地方还不是很明白,暂时也未看懂,希望知道的大神可以赐教 小弟先谢过了!
void I2C_uWriteData(INT8U SlaveAddr,INT16U WriteAddr,INT8U WriteLen,INT8U *WriteBuf)
{
INT8U i;
while(I2C_GetFlagStatus(I2C1,I2C_FLAG_BUSY));
I2C_TransferHandling(I2C1,SlaveAddr,2,I2C_Reload_Mode,I2C_Generate_Start_Write); // I2C_SoftEnd_Mode
while(I2C_GetFlagStatus(I2C1,I2C_FLAG_TXIS) == RESET);
I2C_SendData(I2C1,WriteAddr >> 8);
while(I2C_GetFlagStatus(I2C1,I2C_FLAG_TXIS) == RESET);
I2C_SendData(I2C1,WriteAddr % 256);
while(I2C_GetFlagStatus(I2C1,I2C_FLAG_TCR) == RESET);
I2C_TransferHandling(I2C1,SlaveAddr,WriteLen,I2C_AutoEnd_Mode,I2C_No_StartStop); // I2C_Generate_Start_Write
for(i=0;i |