/* param base I2C base pointer. param handle pointer to i2c_master_handle_t structure which stores the transfer state. param xfer pointer to i2c_master_transfer_t structure. retval kStatus_Success Successfully start the data transmission. retval kStatus_I2C_Busy Previous transmission still not finished. retval kStatus_I2C_Timeout Transfer error, wait signal timeout.  */
status_t I2C_MasterTransferNonBlocking(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_t *xfer)
/* param base I2C base pointer. param handle pointer to i2c_master_handle_t structure which stores the transfer state. param xfer pointer to i2c_master_transfer_t structure. retval kStatus_Success Successfully start the data transmission. retval kStatus_I2C_Busy Previous transmission still not finished. retval kStatus_I2C_Timeout Transfer error, wait signal timeout.  */
status_t I2C_MasterTransferNonBlocking(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_t *xfer)
{
    assert(NULL != handle);
    assert(NULL != xfer);
    status_t result = kStatus_Success;
    if (handle->state != (uint8_t)kIdleState)
    {
        result = kStatus_I2C_Busy;
    }
    else
    {
        result = I2C_InitTransferStateMachine(base, handle, xfer);
        if (result == kStatus_Success)
        {
            I2C_EnableInterrupts(base, (uint32_t)kI2C_GlobalInterruptEnable);
        }
    }
    return result;
}