1.15.9.13 EXTERNAL_INT_PIN_CALLBACK Typedef

C

typedef void (*EXTERNAL_INT_PIN_CALLBACK) (EXTERNAL_INT_PIN pin, uintptr_t context);

Summary

Pointer to a external Pin-Event handler function.

Description

This data type defines the required function signature for the external pin-event handling callback function. The client must register a pointer to an event handling function whose function signature (parameter and return value types) match the types specified by this function pointer in order to receive calls back from the PLIB when a configured pin event occurs.

The parameters and return values are described here and a partial example implementation is provided.

Parameters

Param Description
pin One of the external interrupt pins from the enum EXTERNAL_INT_PIN
context Value identifying the context of the client that registered the event handling function

Returns

None.

Example

A function matching this signature:

void APP_PinEventHandler(EXTERNAL_INT_PIN pin, uintptr_t context)
{
    // Do Something
}

Is registered as follows:

EVIC_ExternalInterruptCallbackRegister(EXTERNAL_INT_1, &APP_PinEventHandler, NULL);

Remarks

The context parameter contains the a handle to the client context, provided at the time the event handling function was registered using the EVIC_ExternalInterruptCallbackRegister 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. The event handler 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.