1.2.23.6 SUPC_CALLBACK Typedef

C

typedef void (*SUPC_CALLBACK)( uintptr_t context );

Summary

Pointer to a SUPC peripheral callback function.

Description

This data type defines the function signature for the SUPC peripheral callback function. Application must register a pointer to a callback function whose function signature (parameter and return value types) match the types specified by this function pointer in order to receive callback from the PLIB.

On some devices the SUPC peripheral library will call back the client's function with this signature when a Brown Out event has been detected. The function will be called only if the BOD33 action in the NVM user row is set to interrupt.

Remarks

SUPC_Initialize() must have been called for the supc peripheral before registering a callback.

SUPC_CallbackRegister() must have been called to set the function to be called.

Parameters

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

Returns

None.

Example

void APP_SUPC_CallbackFunction( uintptr_t context )
{
    // Code to perform any quick action before the supply dies.
}

SUPC_CallbackRegister(APP_SUPC_CallbackFunction, (uintptr_t)NULL);

Remarks

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

The callback function executes in the PLIB's interrupt context. It is recommended of the application to not perform process intensive or blocking operations with in this function.