MPLAB Harmony USB Stack
|
This function returns the current state of the USB device, as described in Chapter 9 of the USB 2.0 Specification.
USB_DEVICE_STATE USB_DEVICE_StateGet( USB_DEVICE_HANDLE usbDeviceHandle );
The USB device layer must have been initialized and opened before calling this function.
Parameters |
Description |
usbDeviceHandle |
Pointer to the device layer handle that is returned from USB_DEVICE_Open |
USB_DEVICE_STATE_DETACHED - Device is not in any of the known states
USB_DEVICE_STATE_ATTACHED - Device is attached to the USB, but is not powered
USB_DEVICE_STATE_POWERED - Device is attached to the USB and powered, but has not been reset
USB_DEVICE_STATE_DEFAULT - Device is attached to the USB and powered and has been reset, but has not been assigned a unique address
USB_DEVICE_STATE_ADDRESS - Device is attached to the USB, powered, has been reset, and a unique device address has been assigned
USB_DEVICE_STATE_CONFIGURED - Device is attached to the USB, powered, has been reset, has a unique address, is configured, and is not suspended
None.
USB_DEVICE_STATE usbDevState; // Get USB Device State. usbDevState = USB_DEVICE_StateGet( usbDeviceHandle ); switch(usbDevState) { case USB_DEVICE_STATE_ATTACHED: // Add code here break; case USB_DEVICE_STATE_POWERED: // Add code here break; default: break; }
MPLAB Harmony USB Stack
|