1.2.21.47 1.3.25.47 1.4.21.47 1.5.25.47 1.6.22.47 1.7.23.47 1.9.19.47 1.29.23.47 1.30.18.47 1.31.18.47 1.32.26.47 1.33.16.47 1.37.18.47 1.38.21.47 1.39.18.47 1.40.20.47 SERCOMx_SPI_ErrorGet Function

C

/* x = SERCOM instance number */

/* SPI slave mode */

SPI_SLAVE_ERROR SERCOMx_SPI_ErrorGet(void)

Summary

Returns the error 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 SERCOMx_SPI_Initialize() should have been called

Parameters

None.

Returns

SPI_SLAVE_ERROR - SPI Slave Errors

Example

void SPIEventHandler(uintptr_t context )
{
    if (SERCOM0_SPI_ErrorGet() == SPI_SLAVE_ERROR_NONE)
    {
        nBytesAvailable = SERCOM0_SPI_ReadCountGet();
        
        nBytesRead = SERCOM0_SPI_Read(APP_RxData, nBytesAvailable);
    }
    else
    {
        // Handle error
    }
    
}

SERCOM0_SPI_CallbackRegister(SPIEventHandler, (uintptr_t) 0);

Remarks

None.