USB Libraries Help > USB Device Libraries > USB Audio 2.0 Device Library > Library Interface > b) Data Types and Constants > USB_DEVICE_AUDIO_V2_EVENT_HANDLER Type
MPLAB Harmony USB Stack
USB_DEVICE_AUDIO_V2_EVENT_HANDLER Type

USB Device Audio v2.0 Event Handler Function Pointer Type. 

This data type defines the required function signature USB Device Audio Function Driver event handling callback function. The application must register a pointer to an Audio Function Driver events handling function who's function signature (parameter and return value types) match the types specified by this function pointer in order to receive event call backs from the Audio Function Driver. The function driver will invoke this function with event relevant parameters. The description of the event handler function parameters is given here. 

instanceIndex - Instance index of the Audio v2.0 Function Driver that generated the event. 

event - Type of event generated. 

pData - This parameter should be type casted to an event specific pointer type based on the event that has occurred. Refer to the USB_DEVICE_AUDIO_V2_EVENT enumeration description for more details. 

context - Value identifying the context of the application that registered the event handling function.

C
typedef USB_DEVICE_AUDIO_V2_EVENT_RESPONSE (* USB_DEVICE_AUDIO_V2_EVENT_HANDLER)(USB_DEVICE_AUDIO_V2_INDEX instanceIndex , USB_DEVICE_AUDIO_V2_EVENT event , void * pData, uintptr_t context);
Remarks

The event handler function executes in the USB interrupt context when the USB Device Stack is configured for interrupt based operation. It is not advisable to call blocking functions or computationally intensive functions in the event handler. Where the response to a control transfer related event requires extended processing, the response to the control transfer should be deferred and the event handler should be allowed to complete execution.