1.3.11.11 EVSYS_CALLBACK Typedef
C
typedef void (*EVSYS_CALLBACK)(uintptr_t context, uint32_t int_cause)
Summary
Pointer to a EVSYS CallBack function.
Description
This data type defines the required function signature for the EVSYS event handling callback function. Application 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 event calls back from the EVSYS PLIB.
The parameters and return values are described here and a partial example implementation is provided.
Parameters
Param | Description |
---|---|
context | Value identifying the context of the application that registered the event handling function |
int_cause | the reason for the interrupt |
Returns
None.
Example
// This is the callback function that is called when an Event
// interrupt is triggered.
void evsysCallBack(uintptr_t contextHandle, uint32_t int_cause)
{
if( int_cause & EVSYS_INTENSET_EVD1_Msk)
{
// Event detected on channel 1
}
if( int_cause & EVSYS_INTENSET_EVD1_Msk)
{
// Event detected on channel 2
}
}
EVSYS_Initialize();
EVSYS_CallbackRegister(&evsysCallBack, NULL);
Remarks
The context parameter can contain a handle to the client context, provided at the time the event handling function was registered using the EVSYS_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 data exchange request. The callback function executes in the driver peripheral interrupt context when the driver is configured for interrupt mode operation. It is recommended of the application to not perform process intensive or blocking operations with in this function.