/* Slave finish up a transfer. It would call back if there is callback function and set the state to idle. This is not a public API.  */
static void LPSPI_SlaveTransferComplete(LPSPI_Type *base, lpspi_slave_handle_t *handle)
/* Slave finish up a transfer. It would call back if there is callback function and set the state to idle. This is not a public API.  */
static void LPSPI_SlaveTransferComplete(LPSPI_Type *base, lpspi_slave_handle_t *handle)
{
    assert(handle);
    status_t status = 0;
    LPSPI_DisableInterrupts(base, kLPSPI_AllInterruptEnable);
    if (handle->state == kLPSPI_Error)
    {
        status = kStatus_LPSPI_Error;
    }
    else
    {
        status = kStatus_Success;
    }
    handle->state = kLPSPI_Idle;
    if (handle->callback)
    {
        handle->callback(base, handle, status, handle->userData);
    }
}