1.8.13.25 PIO_PIN_CALLBACK Typedef

C

typedef void (*PIO_PIN_CALLBACK) ( PIO_PIN pin, uintptr_t context);

Summary

Pointer to a PIO Pin-Event handler function.

Description

This data type defines the required function signature for the PIO 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 IO pins from the enum PIO_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(PIO_PIN pin, uintptr_t context)
{
    // Do Something
}

Is registered as follows:

PIO_PinInterruptCallbackRegister(PIO_PIN_PA5, &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 PIO_PinInterruptCallbackRegister 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.