1.8.10.21 MCSPI_SLAVE_CALLBACK Typedef

C

/* MCSPI slave mode */

typedef void (*MCSPI_SLAVE_CALLBACK) (uintptr_t context )

Summary

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

Description

This data type defines the required function signature for the MCSPI 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

void APP_MCSPICallBack(uintptr_t contextHandle)
{
    if( MCSPI1_ErrorGet() == MCSPI_SLAVE_ERROR_NONE )
    {
        //Exchange was completed without error
    }
}

MCSPI1_CallbackRegister(&APP_MCSPICallBack, NULL);

Remarks

The context parameter contains a handle to the client context, provided at the time the event handling function was registered using the MCSPIx_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.