Jump to main content

##

# 2.117.22 SUPC_CALLBACK Typedef

## C

    typedef void (*SUPC_CALLBACK)(uint32_t supc_status, 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.

## 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
--- | ---
supc_status | SUPC interrupt status
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(uint32_t supc_status, 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.