/* Check that the last event is equal to the last passed event.  */
uint8_t I2C_ReadEventStatus(I2C_T *i2c, I2C_EVENT_T i2cEvent)
/* Check that the last event is equal to the last passed event.  */
uint8_t I2C_ReadEventStatus(I2C_T *i2c, I2C_EVENT_T i2cEvent)
{
    uint32_t lastevent = 0;
    uint32_t flag1 = 0, flag2 = 0;
    flag1 = i2c->STS1 & 0x0000FFFF;
    flag2 = i2c->STS2 & 0x0000FFFF;
    flag2 = flag2 << 16;
    lastevent = (flag1 | flag2) & 0x00FFFFFF;
    if((lastevent & i2cEvent) == i2cEvent)
    {
        return SUCCESS;
    }
    return ERROR;
}