// I2C_ITConfig(I2C1,I2C_IT_EVT,ENABLE);
/* Test on EV6 and clear it */
timeout=0;
// while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED))
while(0==I2C_GetFlagStatus(I2C1,I2C_FLAG_ADDR))
// while( 0==((I2C1->SR1)&0x0002) )
{
if(timeout++>=I2C_TIMEOUT)
{
// timeout = 0; // error
return 0;
}
}
I2C1->SR1;
I2C1->SR2;
/* Send the EEPROM's internal address to write to */
红色字体中间加入如上代码
|