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

The function starts the operation of the USB Host Bus. It enables the root hub associated with specified bus and starts the process of detecting attached devices and enumerating them. The USB_HOST_EventHandlerSet() function should have been called to register an application host layer event handler before the bus is enabled (before the USB_HOST_BusEnable() function is called). This will ensure that the application does not miss any events.

C
USB_HOST_RESULT USB_HOST_BusEnable(
    USB_HOST_BUS bus
);
Preconditions

The USB_HOST_Initialize() function should have been called before calling this function.

Parameters
Parameters 
Description 
bus 
the bus to be enabled. If this is set to USB_HOST_BUS_ALL, all buses will be enabled. 
Returns

USB_HOST_RESULT_SUCCESS if the request was accepted. USB_HOST_RESULT_BUS_UNKNOWN if the specified bus is invalid (it does not exist in the system). USB_HOST_RESULT_FAILURE if an unknown failure occurred.

Remarks

The Host Layer may generate events after the USB_HOST_BusEnable() function is called. The application should have registered an event handler using the USB_HOST_EventHandlerSet() function to handle these events. The USB_HOST_EventHandlerSet() function should have been called before the USB_HOST_BusEnable() function is called.

Example
TBD.