/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param transfer The pointer to the transfer descriptor. retval #kStatus_Success The transaction was started successfully. retval #kStatus_LPI2C_Busy Either another master is currently utilizing the bus, or a non-blocking transaction is already in progress.  */
status_t LPI2C_MasterTransferNonBlocking(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_t *transfer)
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param transfer The pointer to the transfer descriptor. retval #kStatus_Success The transaction was started successfully. retval #kStatus_LPI2C_Busy Either another master is currently utilizing the bus, or a non-blocking transaction is already in progress.  */
status_t LPI2C_MasterTransferNonBlocking(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_t *transfer)
{
    status_t result;
    assert(handle);
    assert(transfer);
    assert(transfer->subaddressSize <= sizeof(transfer->subaddress));
    if (handle->state != kIdleState)
    {
        return kStatus_LPI2C_Busy;
    }
    result = LPI2C_CheckForBusyBus(base);
    if (result)
    {
        return result;
    }
    LPI2C_MasterDisableInterrupts(base, kMasterIrqFlags);
    handle->transfer = *transfer;
    LPI2C_InitTransferStateMachine(handle);
    LPI2C_MasterClearStatusFlags(base, kMasterClearFlags);
    base->MCFGR1 &= ~LPI2C_MCFGR1_AUTOSTOP_MASK;
    LPI2C_MasterEnableInterrupts(base, kMasterIrqFlags);
    return result;
}