1.28.1.5 ACC_RegisterCallback Function

C

void ACC_RegisterCallback (ACC_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 ACC_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_ACC_CallbackFunction (bool status, void* pContext)
{
    // The context was set to an application specific object.
    // It is now retrievable easily in Callback function.
    MY_APP_OBJ myAppObj = (MY_APP_OBJ *) context;
    //Application related tasks
}

ACC_RegisterCallback (APP_ACC_CallbackFunction, &myAppObj);

Remarks

None.