/* brief Reusable routine to handle master interrupts. note This function does not need to be called unless you are reimplementing the nonblocking API's interrupt handler routines to add special functionality. param base The LPI2C peripheral base address. param lpi2cMasterHandle Pointer to the LPI2C master driver handle.  */
void LPI2C_MasterTransferHandleIRQ(LPI2C_Type *base, void *lpi2cMasterHandle)
/* brief Reusable routine to handle master interrupts. note This function does not need to be called unless you are reimplementing the nonblocking API's interrupt handler routines to add special functionality. param base The LPI2C peripheral base address. param lpi2cMasterHandle Pointer to the LPI2C master driver handle.  */
void LPI2C_MasterTransferHandleIRQ(LPI2C_Type *base, void *lpi2cMasterHandle)
{
    assert(lpi2cMasterHandle != NULL);
    lpi2c_master_handle_t *handle = (lpi2c_master_handle_t *)lpi2cMasterHandle;
    bool isDone                   = false;
    status_t result;
    if (NULL != handle)
    {
        if (handle->state != (uint8_t)kIdleState)
        {
            result = LPI2C_RunTransferStateMachine(base, handle, &isDone);
            if ((result != kStatus_Success) || isDone)
            {
                if (result != kStatus_Success)
                {
                    LPI2C_MasterTransferAbort(base, handle);
                }
                LPI2C_MasterDisableInterrupts(base, (uint32_t)kLPI2C_MasterIrqFlags);
                handle->state = (uint8_t)kIdleState;
                if (NULL != handle->completionCallback)
                {
                    handle->completionCallback(base, handle, result, handle->userData);
                }
            }
        }
    }
}