IceCube display
LED display to show IceCube event data

USB device state management. More...

Enumerations

enum  usb_device_state_t {
  ATTACHED, POWERED, DEFAULT, ADDRESSED,
  CONFIGURED, SUSPENDED
}
 USB device states. More...
 

Functions

void set_device_state (enum usb_device_state_t state)
 Set the USB device state. More...
 
enum usb_device_state_t get_device_state ()
 Get the current USB device state.
 

Detailed Description

USB device state management.

As defined by ยง9.1 of the USB 2.0 specification, the device can be in a number of pre-defined states. This state is not usually managed by the microcontroller hardware, so needs to be managed in software.

Enumeration Type Documentation

◆ usb_device_state_t

USB device states.

Enumerator
ATTACHED 

USB hardware is initialised.

POWERED 

USB VBUS is connected, i.e. the 5V USB power supply is present.

DEFAULT 

The USB device is configured with only the default endpoint zero, and address zero.

ADDRESSED 

The USB device is configured with only the default endpoint zero, and a unique address.

CONFIGURED 

The USB device is in a device defined configuration.

SUSPENDED 

The USB device is suspended, i.e. no bus communication has been seen for at least 3ms.

Function Documentation

◆ set_device_state()

void set_device_state ( enum usb_device_state_t  state)

Set the USB device state.

Note
Since the USB activity LED behaviour (see usb/led.h) is linked to the device state, a call to this function also sets the appropriate state for the LED:
Parameters
stateThe new state.