USB Libraries Help > USB Host Libraries > USB Host Layer Library > Library Interface > a) Functions > USB_HOST_EventHandlerSet Function
MPLAB Harmony USB Stack
USB_HOST_EventHandlerSet Function

This is the USB Host Layer Event Handler Callback Set function. An application can receive USB Host Layer events by using this function to register and event handler callback function. The application can additionally specify a specific context which will returned with the event handler callback function. The event handler must be set (this function must be called) before any of the USB buses are enabled.

C
USB_HOST_RESULT USB_HOST_EventHandlerSet(
    USB_HOST_EVENT_HANDLER eventHandler, 
    uintptr_t context
);
Preconditions

The host layer should have been initialized.

Parameters
Parameters 
Description 
eventHandler 
Pointer to the call back function. The host layer notifies the application about host layer events by calling this function. If this is NULL, then events will not be generated.
 
context 
application specific context. 
Returns

USB_HOST_RESULT_SUCCESS - The function was successful. USB_HOST_RESULT_FAILURE - An unknown failure occurred.

Remarks

None.

Example
TBD.