2.2.4.19 USB_DEVICE_ActiveSpeedGet Function

C

USB_SPEED USB_DEVICE_ActiveSpeedGet(
    USB_DEVICE_HANDLE usbDeviceHandle
);

Summary

The USB device stack supports both high speed and full speed operations. This function returns the current operation speed of the USB bus. This function should be called after the USB_DEVICE_EVENT_RESET event has occurred.

Precondition

The USB device layer must have been initialized and a valid handle to USB device layer must have been opened.

Parameters

Parameters Description
usbDeviceHandle Pointer to device layer handle that is returned from USB_DEVICE_Open

Returns

USB_SPEED_LOW - USB module is at low-speed USB_SPEED_FULL - USB module is at full-speed USB_SPEED_HIGH - USB module is at high-speed.

Example

// This code example shows how the 
// USB_DEVICE_GetDeviceSpeed function can be called to obtain
// the current device speed. This information is also
// available in the USB_DEVICE_EVENT_CONFIGURED event.

if(USB_DEVICE_ActiveSpeedGet(usbDeviceHandle) == USB_SPEED_FULL)
{
    // This means the device attached at full speed.
} 
else if(USB_DEVICE_ActiveSpeedGet(usbDeviceHandle) == USB_SPEED_HIGH)
{
    // This means the device attached at high speed.

Remarks

None.