/* Check the parameters */ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_I2C_EVENT(I2C_EVENT));
/* Read the I2Cx status register */ flag1 = I2Cx->SR1; flag2 = I2Cx->SR2; flag2 = flag2 << 16;
/* Get the last event value from I2C status register */ lastevent = (flag1 | flag2) & FLAG_Mask;
/* Check whether the last event is equal to I2C_EVENT */ if (lastevent ==I2C_EVENT ) { /* SUCCESS: last event is equal to I2C_EVENT */ status = SUCCESS; } else { /* ERROR: last event is different from I2C_EVENT */ status =ERROR; }