USB Component  Version 6.6
MDK-Professional Middleware for USB Device and Host
 All Data Structures Functions Variables Enumerations Enumerator Groups Pages
User API

User API reference of the USB Host Core. More...

Functions

usbStatus USBH_Initialize (uint8_t ctrl)
 Initialize USB Host stack and controller.
 
usbStatus USBH_Uninitialize (uint8_t ctrl)
 De-initialize USB Host stack and controller.
 
usbStatus USBH_GetDeviceStatus (uint8_t device)
 Get status of USB Device.
 

Description

User API reference of the USB Host Core.

Function Documentation

usbStatus USBH_GetDeviceStatus ( uint8_t  device)

Get status of USB Device.

Parameters
[in]deviceindex of USB Device.
Returns
status code that indicates the execution status of the function as defined with usbStatus.

The function USBH_GetDeviceStatus checks if a device instance is connected and initialized.

The argument device specifies the instance of the device.

usbStatus USBH_Initialize ( uint8_t  ctrl)

Initialize USB Host stack and controller.

Parameters
[in]ctrlindex of USB Host controller.
Returns
status code that indicates the execution status of the function as defined with usbStatus.

The function USBH_Initialize initializes the USB Host Stack and the USB Host Controller Hardware and prepares the USB Host Controller to detect whether an USB device gets attached or detached from the USB bus. It starts a thread responsible for the USB Device enumeration process. Call this function before calling any other USB Host functions. The function does not initialize any non-USB Host hardware features.

Code Example

#include <rl_usb.h>
int main (void) {
..
USBH_Initialize(0); // USB Host 0 Initialize
..
}
usbStatus USBH_Uninitialize ( uint8_t  ctrl)

De-initialize USB Host stack and controller.

Parameters
[in]ctrlindex of USB Host controller.
Returns
status code that indicates the execution status of the function as defined with usbStatus.

The function USBH_Uninitialize de-initializes the USB Host Stack and the USB Host Controller Hardware. It can be used if during the application run-time the USB Host Stack needs to be disabled for whatever reason (for example for lowering power consumption). Reinitialize the USB Host Stack only with USBH_Initialize.

Code Example

#include <rl_usb.h>
int main (void) {
..
USBH_Initialize(0); // USB Host 0 Initialize
..
USBH_Uninitialize(0); // USB Host 0 De-Initialize
..
}