Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USB dual role driver

USB low-level driver for dual role features.

Functions

void usb_dual_disable (void)
 Deinitialize the dual role driver. More...
 
bool usb_dual_enable (void)
 Initialize the USB peripheral and set right role according to ID pin. More...
 

USB ID pin management

The ID pin come from the USB connector (A and B receptable) and allows to select the USB mode between host or device.

The ID pin can be managed through EIC pin. This feature is optional, and it is enabled if USB_ID_PIN is defined in board.h and CONF_BOARD_USB_ID_DETECT defined in conf_board.h.

#define USB_ID_DETECT   (defined(CONF_BOARD_USB_ID_DETECT))
 
#define USB_ID_EIC   (defined(USB_ID_PIN) && USB_ID_DETECT)
 

USB Vbus management

The VBus line can be monitored through a EIC pin and a basic resistor voltage divider.

This feature is optional, and it is enabled if USB_VBUS_PIN is defined in board.h and CONF_BOARD_USB_VBUS_DETECT defined in conf_board.h.

#define USB_VBUS_DETECT   (defined(CONF_BOARD_USB_VBUS_DETECT))
 
#define USB_VBUS_EIC   (defined(USB_VBUS_PIN) && USB_VBUS_DETECT)
 

#define USB_ID_DETECT   (defined(CONF_BOARD_USB_ID_DETECT))
#define USB_ID_EIC   (defined(USB_ID_PIN) && USB_ID_DETECT)
#define USB_VBUS_DETECT   (defined(CONF_BOARD_USB_VBUS_DETECT))
#define USB_VBUS_EIC   (defined(USB_VBUS_PIN) && USB_VBUS_DETECT)

void usb_dual_disable ( void  )

Deinitialize the dual role driver.

References _initialized, EXTINT_CALLBACK_TYPE_DETECT, extint_chan_disable_callback(), and USB_ID_EIC_LINE.

Referenced by udd_disable().

bool usb_dual_enable ( void  )

Initialize the USB peripheral and set right role according to ID pin.

Returns
true if the ID pin management has been started, otherwise false.

End of host or device startup, the current mode selected is already started now

References _initialized, _usb_is_id_device, port_config::direction, port_config::input_pull, port_get_config_defaults(), PORT_PIN_DIR_INPUT, PORT_PIN_PULL_UP, port_pin_set_config(), udc_start(), uhc_start, usb_id_config(), and USB_ID_PIN.

Referenced by udd_enable().