/* Check the parameters */
assert_param(IS_I2C_EVENT_OK(I2C_Event));
flag1 = I2C->SR1;
flag2 = I2C->SR2;
/* Check which SRx register must be read */
if (((u16)I2C_Event & (u16)0x0F00) == 0x0700)
{
/* Check whether the last event is equal to I2C_EVENT */
if (flag1 & (u8)I2C_Event)
{
/* SUCCESS: last event is equal to I2C_EVENT */
status = SUCCESS;
}
else
{
/* ERROR: last event is different from I2C_EVENT */
status = ERROR;
}
}
else /* Returns whether the status register to check is SR2 */
{
if (flag2 & (u8)I2C_Event)
{
/* SUCCESS: last event is equal to I2C_EVENT */
status = SUCCESS;
}
else
{
/* ERROR: last event is different from I2C_EVENT */
status = ERROR;
}
}