/* Master sends single byte through the I2Cx peripheral to detect slave device.  */
int32_t I2C_MasterSendNullData_TimeOut(I2C_TypeDef *I2Cx, int32_t address, uint32_t timeout_ms)
/* Master sends single byte through the I2Cx peripheral to detect slave device.  */
int32_t I2C_MasterSendNullData_TimeOut(I2C_TypeDef *I2Cx, int32_t address, uint32_t timeout_ms)
{
    uint8_t I2CTemp = (uint8_t)(address<<1);
    I2C_MasterSendNullData(I2Cx, &I2CTemp, 0, 1, 0);
    DelayMs(timeout_ms);
    if(I2C_GetRawINT(I2Cx) & BIT_IC_RAW_INTR_STAT_TX_ABRT) {
        I2C_ClearAllINT(I2Cx);
        DelayUs(100);
        I2C_Cmd(I2Cx, DISABLE);
        I2C_Cmd(I2Cx, ENABLE);
        return CSI_ERROR;
    }
    return CSI_OK;
}