//EV5事件被检测到,发送设备地址
I2C_Send7bitAddress(EEPROM_I2C,EEPROM_ADDR,I2C_Direction_Receiver);
while(I2C_CheckEvent(EEPROM_I2C,I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED ) == ERROR);
while(numByteToRead)
{
if(numByteToRead == 1)
{
//如果为最后一个字节
I2C_AcknowledgeConfig (EEPROM_I2C,DISABLE);
}
//EV7事件被检测到
while(I2C_CheckEvent(EEPROM_I2C,I2C_EVENT_MASTER_BYTE_RECEIVED ) == ERROR);
//EV7事件被检测到,即数据寄存器有新的有效数据
*data = I2C_ReceiveData(EEPROM_I2C);
为什么这里是先检测事件再接收数据呢 明明书上写的是先接收数据再检测事件 |