1.8.7.49 1.25.6.49 1.26.5.49 1.27.5.49 1.28.6.49 1.36.7.47 1.41.5.49 1.42.3.49 FLEXCOM_SPI_SLAVE_CALLBACK Typedef

C

/* SPI slave mode */

typedef void (*FLEXCOM_SPI_SLAVE_CALLBACK) (uintptr_t context )

Summary

Pointer to a SPI Call back function when SPI is configued in slave mode.

Description

This data type defines the required function signature for the SPI slave event handling callback function. Application must register a pointer to an event handling function whose function signature (parameter and return value types) match the types specified by this function pointer in order to receive event calls back from the PLIB. The parameters and return values are described here and a partial example implementation is provided.

Parameters

Param Description
context Allows the caller to provide a context value (usually a pointer to the callers context)

Returns

None

Example

```c
FLEXCOM0_SPI_CallbackRegister(&APP_SPICallBack, NULL);

void APP_SPICallBack(uintptr_t context)
{
    if( FLEXCOM0_SPI_ErrorGet() == FLEXCOM_SPI_SLAVE_ERROR_NONE )
    {
        //Exchange was completed without error
    }
}

Remarks

The context parameter contains a handle to the client context, provided at the time the event handling function was registered using the FLEXCOMx_SPI_CallbackRegister function. This context handle value is passed back to the client as the "context" parameter. It can be any value (such as a pointer to the client's data) necessary to identify the client context or instance of the client that made the data exchange request. The event handler function executes in the PLIB's interrupt context. It is recommended of the application to not perform process intensive or blocking operations within this function.