/* Checks whether the specified interrupt has occurred or not.  */
uint8_t I2C_ReadIntFlag(I2C_T *i2c, I2C_INT_FLAG_T flag)
/* Checks whether the specified interrupt has occurred or not.  */
uint8_t I2C_ReadIntFlag(I2C_T *i2c, I2C_INT_FLAG_T flag)
{
    uint32_t temp = 0;
    uint32_t enable = 0;
    if (flag & ((uint32_t)0x000000C0))
    {
        enable = (uint32_t)((BIT6) & (i2c->CTRL1));
    }
    else if (flag & ((uint32_t)0x00003F00))
    {
        enable = (uint32_t)((BIT7) & (i2c->CTRL1));
    }
    else
    {
        enable = (uint32_t)((flag) & (i2c->CTRL1));
    }
    temp = i2c->STS;
    temp &= flag;
    if ((temp != 0) && enable)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}