1.8.16.6 RSTC_CallbackRegister Function
C
void RSTC_CallbackRegister (RSTC_CALLBACK callback, uintptr_t context)
Summary
Allows application to register callback with PLIB
Description
This function allows application to register a callback function for the PLIB to call back when interrupt occurred. At any point if application wants to stop the callback, it can call this function with "callback" value as NULL.
Precondition
The RSTC_Initialize function must have been called.
Parameters
Param | Description |
---|---|
callback | Pointer to the callback function implemented by the user |
context | The value of parameter will be passed back to the application unchanged when the callback function is called. It can be used to identify any application specific value that identifies the instance of the client module (for example, it may be a pointer to the client module's state structure) |
Returns
None.
Example
MY_APP_OBJ myAppObj;
void APP_RSTC_CallbackFunction(uintptr_t context)
{
// The context was set to an application specific object.
// It is now retrievable easily in the event handler.
MY_APP_OBJ myAppObj = (MY_APP_OBJ *) context;
//Application related tasks
}
RSTC_CallbackRegister(APP_RSTC_CallbackFunction, (uintptr_t)&myAppObj);
Remarks
None.