1.18.18.11 SPIx_ErrorGet Function

C

/* x = SPI instance number */

/* SPI slave mode */
SPI_SLAVE_ERROR SPIx_ErrorGet(void)

Summary

Returns the status of SPI transfer

Description

This function returns the error status of the last SPI transfer. Applicaiton must check the status of a transfer in the application callback and take appropriate action in case there is an error during the data transfer. Calling this API clears the error status flags.

Precondition

The SPIx_Initialize() should have been called.

Parameters

None.

Returns

SPI_SLAVE_ERROR - SPI Slave Errors

Example

void SPIEventHandler(uintptr_t context )
{
    if (SPI1_ErrorGet() == SPI_SLAVE_ERROR_NONE)
    {
        nBytesAvailable = SPI1_ReadCountGet();
        
        nBytesRead = SPI1_Read(APP_RxData, nBytesAvailable);
    }
    else
    {
        // Handle error
    }
    
}

SPI1_CallbackRegister(SPIEventHandler, (uintptr_t) 0);

Remarks

None.