Microchip® Advanced Software Framework

usb_dual.h File Reference

SAM USB Dual Role driver header file.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"
#include "preprocessor.h"
#include "conf_board.h"
#include "board.h"
#include "extint.h"
#include "port.h"

Macros

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)
 

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...