1.25.10.22 PIO_PinInterruptCallbackRegister Function
C
bool PIO_PinInterruptCallbackRegister(
PIO_PIN pin,
const PIO_PIN_CALLBACK callBack,
uintptr_t context
);
Summary
Allows application to register callback for every pin.
Description
This function allows application to register an event handling function for the PLIB to call back when I/O interrupt occurs on the selected pin.
At any point if application wants to stop the callback, it can call this function with "eventHandler" value as NULL.
If a pin is not configured for interrupt in Pin Manager and yet its callback registration is attempted using this API, then registration doesn't happen and API returns false indicating the same.
Precondition
Corresponding pin must be configured in interrupt mode in MHC Pin Manager. The PIO_Initialize function must have been called.
Parameters
Param | Description |
---|---|
pin | One of the IO pins from the enum PIO_PIN |
eventHandler | Pointer to the event handler function implemented by the user |
context | The value of parameter will be passed back to the application unchanged, when the eventHandler function is called. It can be used to identify any application specific value. |
Returns
Callback registration status: - true: Callback was successfully registered - false: Callback was not registered
Example
if(PIO_PinInterruptCallbackRegister(PIO_PIN_PB3, &APP_PinHandler, NULL)) { // callback got registered }
Remarks
None.