/* Enable specify I2C Controller and set Clock Divider.  */
uint32_t I2C_Open(I2C_T *i2c, uint32_t u32BusClock)
/* Enable specify I2C Controller and set Clock Divider.  */
uint32_t I2C_Open(I2C_T *i2c, uint32_t u32BusClock)
{
    uint32_t u32Div;
    uint32_t u32Pclk;
    if ((i2c == I2C1) || (i2c == I2C3))
    {
        u32Pclk = CLK_GetPCLK1Freq();
    }
    else
    {
        u32Pclk = CLK_GetPCLK0Freq();
    }
    u32Div = (uint32_t)(((u32Pclk * 10U) / (u32BusClock * 4U) + 5U) / 10U - 1U);
    i2c->CLKDIV = u32Div;
    i2c->CTL0 |= I2C_CTL0_I2CEN_Msk;
    return (u32Pclk / ((u32Div + 1U) << 2U));
}