1.34.21.7 SUPC_CallbackRegister Function

C

void SUPC_CallbackRegister( SUPC_CALLBACK callback, uintptr_t context )

Summary

Registers the function to be called when a Brown Out Event has occurred.

Description

This function registers the callback function to be called

This function allows application to register a callback function for the PLIB to callback. The callback should be registered before the client performs transfer operation.

On some devices this callback will be called when a interrupt occurred due to Supply monitor detection.

On some devices this callback will be called when a Brown Out event has occurred. Note that the callback function will be called only if the BOD33 action setting is configured to generate an interrupt and not reset the system.

At any point if application wants to stop the callback, it can call this function with "callback" value as NULL.

Precondition

SUPC_Initialize() must have been called before registering a callback.

Parameters

Param Description
callback Pointer to the callback function
context Allows the caller to provide a context value (usually a pointer to the callers context for multi-instance clients).

Returns

None.

Example

MY_APP_OBJ myAppObj;

void APP_SUPC_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
}

SUPC_CallbackRegister(APP_SUPC_CallbackFunction, (uintptr_t)&myAppObj);

Remarks

Context value can be set to NULL if not required. To disable callback function, pass NULL for the callback parameter