Microchip® Advanced Software Framework

common/services/usb/class/composite/device/example3/conf_usb.h File Reference

USB configuration file.

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

#include "compiler.h"
#include "udi_hid_kbd.h"
#include "udi_msc.h"
#include "main.h"
#include "ui.h"

Macros

#define USB_DEVICE_VENDOR_ID   USB_VID_ATMEL
 USB Device Configuration. More...
 
#define USB_DEVICE_PRODUCT_ID   USB_PID_ATMEL_ASF_MSC_HIDKEYBOARD
 
#define USB_DEVICE_MAJOR_VERSION   1
 
#define USB_DEVICE_MINOR_VERSION   0
 
#define USB_DEVICE_POWER   100
 
#define USB_DEVICE_ATTR   (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED)
 
#define USB_DEVICE_MANUFACTURE_NAME   "ATMEL ASF"
 USB Device string definitions (Optional) More...
 
#define USB_DEVICE_PRODUCT_NAME   "HID Keyboard and MSC"
 
#define USB_DEVICE_SERIAL_NAME   "123123123123"
 
#define UDC_VBUS_EVENT(b_vbus_high)
 Device speeds support. More...
 
#define UDC_SOF_EVENT()   main_sof_action()
 
#define UDC_SUSPEND_EVENT()   main_suspend_action()
 
#define UDC_RESUME_EVENT()   main_resume_action()
 
#define UDC_REMOTEWAKEUP_ENABLE()   main_remotewakeup_enable()
 Mandatory when USB_DEVICE_ATTR authorizes remote wakeup feature. More...
 
#define UDC_REMOTEWAKEUP_DISABLE()   main_remotewakeup_disable()
 
#define USB_DEVICE_EP_CTRL_SIZE   64
 When a extra string descriptor must be supported other than manufacturer, product and serial string. More...
 
#define USB_DEVICE_NB_INTERFACE   2
 Two interfaces for this device (MSC + HID keyboard) More...
 
#define USB_DEVICE_MAX_EP   3
 3 endpoints used by HID keyboard and MSC interfaces More...
 
#define UDI_MSC_GLOBAL_VENDOR_ID   'A', 'T', 'M', 'E', 'L', ' ', ' ', ' '
 USB Interface Configuration. More...
 
#define UDI_MSC_GLOBAL_PRODUCT_VERSION   '1', '.', '0', '0'
 
#define UDI_MSC_ENABLE_EXT()   main_msc_enable()
 Interface callback definition. More...
 
#define UDI_MSC_DISABLE_EXT()   main_msc_disable()
 
#define UDI_MSC_EP_IN   (1 | USB_EP_DIR_IN)
 USB MSC low level configuration In standalone these configurations are defined by the MSC module. More...
 
#define UDI_MSC_EP_OUT   (2 | USB_EP_DIR_OUT)
 
#define UDI_MSC_IFACE_NUMBER   0
 Interface number. More...
 
#define UDI_HID_KBD_ENABLE_EXT()   main_keyboard_enable()
 Configuration of HID Keyboard interface. More...
 
#define UDI_HID_KBD_DISABLE_EXT()   main_keyboard_disable()
 
#define UDI_HID_KBD_CHANGE_LED(value)   ui_kbd_led(value)
 
#define UDI_HID_KBD_EP_IN   (3 | USB_EP_DIR_IN)
 USB HID Keyboard low level configuration In standalone these configurations are defined by the HID Keyboard module. More...
 
#define UDI_HID_KBD_IFACE_NUMBER   1
 Interface number. More...
 
#define UDI_COMPOSITE_DESC_T
 Description of Composite Device. More...
 
#define UDI_COMPOSITE_DESC_FS
 USB Interfaces descriptor value for Full Speed. More...
 
#define UDI_COMPOSITE_DESC_HS
 USB Interfaces descriptor value for High Speed. More...
 
#define UDI_COMPOSITE_API
 USB Interface APIs. More...
 

#define UDC_REMOTEWAKEUP_DISABLE ( )    main_remotewakeup_disable()
#define UDC_REMOTEWAKEUP_ENABLE ( )    main_remotewakeup_enable()

Mandatory when USB_DEVICE_ATTR authorizes remote wakeup feature.

#define UDC_RESUME_EVENT ( )    main_resume_action()
#define UDC_SOF_EVENT ( )    main_sof_action()
#define UDC_SUSPEND_EVENT ( )    main_suspend_action()
#define UDC_VBUS_EVENT (   b_vbus_high)

Device speeds support.

To define a Low speed device To authorize the High speed USB Device Callbacks definitions (Optional)

#define UDI_COMPOSITE_API
Value:
UDC_DESC_STORAGE udi_api_t udi_api_msc
Global structure which contains standard UDI API for UDC.
Definition: udi_msc.c:66
UDC_DESC_STORAGE udi_api_t udi_api_hid_kbd
Global structure which contains standard UDI interface for UDC.
Definition: udi_hid_kbd.c:60

USB Interface APIs.

#define UDI_COMPOSITE_DESC_FS
Value:
.udi_msc = UDI_MSC_DESC_FS, \
.hid_kbd = UDI_HID_KBD_DESC
#define UDI_MSC_DESC_FS
Content of MSC interface descriptor for full speed only.
Definition: udi_msc.h:108
#define UDI_HID_KBD_DESC
Content of HID keyboard interface descriptor for all speed.
Definition: udi_hid_kbd.h:89

USB Interfaces descriptor value for Full Speed.

#define UDI_COMPOSITE_DESC_HS
Value:
.udi_msc = UDI_MSC_DESC_HS, \
.hid_kbd = UDI_HID_KBD_DESC
#define UDI_HID_KBD_DESC
Content of HID keyboard interface descriptor for all speed.
Definition: udi_hid_kbd.h:89
#define UDI_MSC_DESC_HS
Content of MSC interface descriptor for high speed only.
Definition: udi_msc.h:115

USB Interfaces descriptor value for High Speed.

#define UDI_COMPOSITE_DESC_T
Value:
udi_msc_desc_t udi_msc; \
udi_hid_kbd_desc_t hid_kbd
Interface descriptor structure for MSC.
Definition: udi_msc.h:69

Description of Composite Device.

USB Interfaces descriptor structure

#define UDI_HID_KBD_CHANGE_LED (   value)    ui_kbd_led(value)
#define UDI_HID_KBD_DISABLE_EXT ( )    main_keyboard_disable()
#define UDI_HID_KBD_ENABLE_EXT ( )    main_keyboard_enable()

Configuration of HID Keyboard interface.

Interface callback definition

#define UDI_HID_KBD_EP_IN   (3 | USB_EP_DIR_IN)

USB HID Keyboard low level configuration In standalone these configurations are defined by the HID Keyboard module.

For composite device, these configuration must be defined hereEndpoint numbers definition

Referenced by udi_hid_kbd_send_report().

#define UDI_HID_KBD_IFACE_NUMBER   1

Interface number.

#define UDI_MSC_DISABLE_EXT ( )    main_msc_disable()
#define UDI_MSC_ENABLE_EXT ( )    main_msc_enable()

Interface callback definition.

#define UDI_MSC_EP_IN   (1 | USB_EP_DIR_IN)

USB MSC low level configuration In standalone these configurations are defined by the MSC module.

For composite device, these configuration must be defined hereEndpoint numbers definition

#define UDI_MSC_EP_OUT   (2 | USB_EP_DIR_OUT)
#define UDI_MSC_GLOBAL_PRODUCT_VERSION   '1', '.', '0', '0'
#define UDI_MSC_GLOBAL_VENDOR_ID   'A', 'T', 'M', 'E', 'L', ' ', ' ', ' '

USB Interface Configuration.

Configuration of MSC interfaceVendor name and Product version of MSC interface

#define UDI_MSC_IFACE_NUMBER   0

Interface number.

#define USB_DEVICE_EP_CTRL_SIZE   64

When a extra string descriptor must be supported other than manufacturer, product and serial string.

USB Device low level configuration When only one interface is used, these configurations are defined by the class module. For composite device, these configuration must be defined hereControl endpoint size

#define USB_DEVICE_MAJOR_VERSION   1
#define USB_DEVICE_MANUFACTURE_NAME   "ATMEL ASF"

USB Device string definitions (Optional)

#define USB_DEVICE_MAX_EP   3

3 endpoints used by HID keyboard and MSC interfaces

#define USB_DEVICE_MINOR_VERSION   0
#define USB_DEVICE_NB_INTERFACE   2

Two interfaces for this device (MSC + HID keyboard)

#define USB_DEVICE_POWER   100
#define USB_DEVICE_PRODUCT_ID   USB_PID_ATMEL_ASF_MSC_HIDKEYBOARD
#define USB_DEVICE_PRODUCT_NAME   "HID Keyboard and MSC"
#define USB_DEVICE_SERIAL_NAME   "123123123123"
#define USB_DEVICE_VENDOR_ID   USB_VID_ATMEL

USB Device Configuration.

Device definition (mandatory)