3.4.4.3 USB_HOST_CDC_AttachEventHandlerSet Function

C

USB_HOST_CDC_RESULT USB_HOST_CDC_AttachEventHandlerSet(
    USB_HOST_CDC_ATTACH_EVENT_HANDLER eventHandler, 
    uintptr_t context
);

Summary

This function will set an attach event handler. The attach event handler will be called when a CDC device has been attached. The context will be returned in the event handler. This function should be called before the bus has been enabled.

Precondition

None.

Parameters

Parameters Description
eventHandler pointer to the attach event handler.
context an application defined context that will be returned in the event handler.

Returns

USB_HOST_CDC_RESULT_SUCCESS - if the attach event handler was registered successfully.

USB_HOST_CDC_RESULT_FAILURE - if the number of registered event handlers has exceeded USB_HOST_CDC_ATTACH_LISTENERS_NUMBER.

Remarks

Function should be called before USB_HOST_BusEnable() function is called.