/* param base The I2C peripheral base address. param handle Pointer to the I2C master driver handle. param xfer The pointer to the transfer descriptor. retval kStatus_Success The transaction was started successfully. retval #kStatus_I2C_Busy Either another master is currently utilizing the bus, or a non-blocking transaction is already in progress.  */
status_t I2C_MasterTransferNonBlocking(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_t *xfer)
/* param base The I2C peripheral base address. param handle Pointer to the I2C master driver handle. param xfer The pointer to the transfer descriptor. retval kStatus_Success The transaction was started successfully. retval #kStatus_I2C_Busy Either another master is currently utilizing the bus, or a non-blocking transaction is already in progress.  */
status_t I2C_MasterTransferNonBlocking(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_t *xfer)
{
    status_t result;
    assert(handle != NULL);
    assert(xfer != NULL);
    assert(xfer->subaddressSize <= sizeof(xfer->subaddress));
    if (handle->state != (uint8_t)kIdleState)
    {
        return kStatus_I2C_Busy;
    }
    I2C_DisableInterrupts(base, (uint32_t)kI2C_MasterIrqFlags);
    result = I2C_InitTransferStateMachine(base, handle, xfer);
    I2C_ClearStatusFlags(base, I2C_STAT_MSTARBLOSS_MASK | I2C_STAT_MSTSTSTPERR_MASK);
    I2C_EnableInterrupts(base, (uint32_t)kI2C_MasterIrqFlags);
    return result;
}