Atmel AVR4905: ASF - USB Device HID Generic. 8-/32-bit Atmel Microcontrollers. Application Note. Features. 1 Introduction



Similar documents
Atmel AVR4903: ASF - USB Device HID Mouse Application. Atmel Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR4904: ASF - USB Device HID Keyboard Application. Atmel Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR4921: ASF - USB Device Stack Differences between ASF V1 and V2. 8-bit Atmel Microcontrollers. Application Note. Features.

Atmel AVR4920: ASF - USB Device Stack - Compliance and Performance Figures. Atmel Microcontrollers. Application Note. Features.

How To Use An Atmel Atmel Avr32848 Demo For Android (32Bit) With A Microcontroller (32B) And An Android Accessory (32D) On A Microcontroller (32Gb) On An Android Phone Or

AVR115: Data Logging with Atmel File System on ATmega32U4. Microcontrollers. Application Note. 1 Introduction. Atmel

32-bit AVR UC3 Microcontrollers. 32-bit AtmelAVR Application Note. AVR32769: How to Compile the standalone AVR32 Software Framework in AVR32 Studio V2

Application Note. 8-bit Microcontrollers. AVR270: USB Mouse Demonstration

AVR287: USB Host HID and Mass Storage Demonstration. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AT02985: User s Guide for USB-CAN Demo on SAM4E-EK. Atmel AVR 32-bit Microcontroller. Features. Description.

Atmel AVR4950: ASF - USB Host Stack. 8-bit Atmel Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR1017: XMEGA - USB Hardware Design Recommendations. 8-bit Atmel Microcontrollers. Application Note. Features.

APPLICATION NOTE. Atmel LF-RFID Kits Overview. Atmel LF-RFID Kit. LF-RFID Kit Introduction

Application Note. Atmel ATSHA204 Authentication Modes. Prerequisites. Overview. Introduction

8-bit. Application Note. Microcontrollers. AVR282: USB Firmware Upgrade for AT90USB

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

Application Note. 8-bit Microcontrollers. AVR272: USB CDC Demonstration UART to USB Bridge

APPLICATION NOTE Atmel AT02509: In House Unit with Bluetooth Low Energy Module Hardware User Guide 8-bit Atmel Microcontroller Features Description

AVR1900: Getting started with ATxmega128A1 on STK bit Microcontrollers. Application Note. 1 Introduction

AVR1922: Xplain Board Controller Firmware. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AT01095: Joystick Game Controller Reference Design. 8-/16-bit Atmel Microcontrollers. Features.

AT91SAM ARM-based Flash MCU. Application Note

Application Note. Atmel CryptoAuthentication Product Uses. Atmel ATSHA204. Abstract. Overview

Atmel AVR4907: ASF - USB Device CDC Application. Atmel Microcontrollers. Application Note. Features. 1 Introduction

AVR1510: Xplain training - XMEGA USART. 8-bit Microcontrollers. Application Note. Prerequisites. 1 Introduction

APPLICATION NOTE. Atmel AT04389: Connecting SAMD20E to the AT86RF233 Transceiver. Atmel SAMD20. Description. Features

AVR32701: AVR32AP7 USB Performance. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

Application Note. 8-bit Microcontrollers. AVR293: USB Composite Device

AT88CK490 Evaluation Kit

How To Design An Ism Band Antenna For 915Mhz/2.4Ghz Ism Bands On A Pbbb (Bcm) Board

USER GUIDE. ZigBit USB Stick User Guide. Introduction

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

AVR033: Getting Started with the CodeVisionAVR C Compiler. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor. Atmel AVR 8-bit Microcontrollers. Features.

AVR32138: How to optimize the ADC usage on AT32UC3A0/1, AT32UC3A3 and AT32UC3B0/1 series. 32-bit Microcontrollers. Application Note.

Introducing a platform to facilitate reliable and highly productive embedded developments

AVR32788: AVR 32 How to use the SSC in I2S mode. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AT89C5131A Starter Kit... Software User Guide

AVR125: ADC of tinyavr in Single Ended Mode. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Software Prerequisites Linux Ubuntu LTS. Estimated completion time: 15min. The goal of this hands-on is to:

Atmel AT32UC3A3256 microcontroller 64MBit SDRAM Analog input (to ADC) Temperature sensor RC filter

USER GUIDE EDBG. Description

AVR1321: Using the Atmel AVR XMEGA 32-bit Real Time Counter and Battery Backup System. 8-bit Microcontrollers. Application Note.

8051 Flash Microcontroller. Application Note. A Digital Thermometer Using the Atmel AT89LP2052 Microcontroller

AVR1318: Using the XMEGA built-in AES accelerator. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers. 8-bit Atmel Microcontrollers. Application Note.

Using CryptoMemory in Full I 2 C Compliant Mode. Using CryptoMemory in Full I 2 C Compliant Mode AT88SC0104CA AT88SC0204CA AT88SC0404CA AT88SC0808CA

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1600: Using the XMEGA Quadrature Decoder. 8-bit Microcontrollers. Application Note. Features. 1 Introduction. Sensors

APPLICATION NOTE. AT07175: SAM-BA Bootloader for SAM D21. Atmel SAM D21. Introduction. Features

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

APPLICATION NOTE. Atmel AVR600: STK600 Expansion, Routing and Socket Boards. Atmel Microcontrollers. Introduction

AVR030: Getting Started with IAR Embedded Workbench for Atmel AVR. 8-bit Microcontrollers. Application Note. Features.

Atmel AVR ATxmega384C3 microcontroller OLED display with pixels resolution Analog sensors. Ambient light sensor Temperature sensor

AVR ONE!... Quick-start Guide. EVK Windows 32104B AVR ONE! 02/10

Section 1 Introduction to the AT91SAMD20 and the Development Environment

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

AVR353: Voltage Reference Calibration and Voltage ADC Usage. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. AT16268: JD Smart Cloud Based Smart Plug Getting. Started Guide ATSAMW25. Introduction. Features

CryptoAuth Xplained Pro

Two mechanical buttons Two user LEDs Four expansion headers. Board controller with USB interface. One power LED and one status LED

AVR1301: Using the XMEGA DAC. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AVR2033: SAM-ICE Adapter Hardware User Manual. 8-bit Atmel Microcontrollers. Features. Introduction

AN3354 Application note

General Porting Considerations. Memory EEPROM XRAM

APPLICATION NOTE. Atmel AT01180: Barcode and QR code scanner User Guide. Atmel 32-bit Microcontroller. Features. Introduction

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

Dell Statistica Statistica Enterprise Installation Instructions

AVR2006: Design and characterization of the Radio Controller Board's 2.4GHz PCB Antenna. Application Note. Features.

Dell Spotlight on Active Directory Server Health Wizard Configuration Guide

APPLICATION NOTE. Secure Personalization with Transport Key Authentication. ATSHA204A, ATECC108A, and ATECC508A. Introduction.

AT09333: USB Host Interface (UHI) for Communication Class Device (CDC) Introduction. Atmel Microcontrollers APPLICATION NOTE

Spotlight Management Pack for SCOM

PL-2303 (Chip Rev H, HX, X) USB to Serial Adapter Windows Driver Installer Manual

Atmel ATSAM3X8E microcontroller Atmel AT86RF GHz radio transceiver Atmel proprietary Lightweight Mesh software stack 10/100Mbps Ethernet

4.0. Offline Folder Wizard. User Guide

Using WinUSB in a Visual Studio Project with Freescale USB device controller

Spotlight Management Pack for SCOM

Application Note. 1. Introduction. 2. Associated Documentation. 3. Gigabit Ethernet Implementation on SAMA5D3 Series. AT91SAM ARM-based Embedded MPU

AVR245: Code Lock with 4x4 Keypad and I2C LCD. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

MODFLEX MINI GATEWAY ETHERNET USER S GUIDE

Getting started with DfuSe USB device firmware upgrade STMicroelectronics extension

AN3265 Application note

FN:PCMCSET-M1.DOC. PCMCSET SOFTWARE for ATS Master Clocks System Clocks and Displays

New Features and Enhancements

ChangeAuditor 5.6. For Windows File Servers Event Reference Guide

APPLICATION NOTE. Authentication Counting. Atmel CryptoAuthentication. Features. Introduction

How To Connect A Port Replicator With An Ethernet To A Usb Port From A Usb Device

Application Note. USB Microcontrollers. USB PC Drivers Based on Generic HID Class. 1. Introduction

Designing Feature-Rich User Interfaces for Home and Industrial Controllers

Dell One Identity Cloud Access Manager How to Configure vworkspace Integration

AT91 ARM Thumb Microcontrollers. AT91SAM CAN Bootloader. AT91SAM CAN Bootloader User Notes. 1. Description. 2. Key Features

HANDLING SUSPEND MODE ON A USB MOUSE

Atmel AVR4029: Atmel Software Framework User Guide. Atmel Microcontrollers. Application Note. Features. 1 Introduction

8-bit RISC Microcontroller. Application Note. AVR182: Zero Cross Detector

Application Note. C51 Bootloaders. C51 General Information about Bootloader and In System Programming. Overview. Abreviations

Dell Statistica Document Management System (SDMS) Installation Instructions

AN3990 Application note

IDGo 800 Minidriver for Windows. User Guide

Transcription:

Atmel AVR4905: ASF - USB Device HID Generic Features USB 2.0 compliance - Chapter 9 compliance - Low Speed (1.5Mbit/s), Full Speed (12Mbit/s), High Speed (480Mbit/s) data rates IN and OUT interrupt transfer Small stack size frees space for main application Remote wakeup support USB bus powered support Real time (O.S. compliance, interrupt driven) Support 8-bit and 32-bit Atmel AVR 8-/32-bit Atmel Microcontrollers Application Note 1 Introduction The aim of this document is to provide an easy way to integrate a USB Device HID Generic application on a new or existing project. Rev.

2 Abbreviations ASF: CD: FS: HID: HS: LS: UDC: UDD: UDI: USB: SOF: AVR Software Framework Composite Device: a USB device with more than one interface USB Full Speed Human Interface Device USB High Speed USB Low Speed USB device Controller USB device Descriptor USB device Interface Universal Serial Bus Start of Frame 2 Atmel AVR4905

Atmel AVR4905 3 Overview This document includes seven sections for all types of requirements when building a USB device HID Generic application: HID Generic Solution Introduction Provides information about the HID Generic solution s advantages Quick start Describes how to start a ready to use HID Generic device example Demo behavior Describes the entire demo, PC application and device Example description Describes a HID Generic device example Building a USB device HID Generic Describes how to add a USB HID Generic device interface in a project HID Generic in a USB composite device Describes how to integrate a HID Generic interface in a composite device project For all these sections, it is recommended to know the main modules organization of a HID Generic class application: User application USB device Interface HID Generic (UDI - HID_GENERIC) USB device Controller (UDC) USB device Driver (UDD) For more advanced information concerning the USB stack implementation, please refer to the Atmel AVR4900 ASF USB Device stack application note. Figure 3-1. USB HID Generic class solution architecture. Application UDC UDI HID_GENERIC UDD USB device stack from the ASF NOTE The USB device stack is available in the ASF in the common/services/usb directory. 3

4 HID Generic solution introduction The USB interface becomes very complex when the user data does not fit with USB standard classes (Mass Storage, Audio, Video...). Specific drivers must be developed, requiring a significant amount of development time. Atmel has developed a solution to save time and development efforts. This solution is based on HID class. It ensures a full duplex transfer between the device and the PC (up to 64Kbytes/s for Full Speed devices). The HID class is supported by all Microsoft OS from Windows 98SE and later. It is also supported by most other OS running on PCs (at time of publication). 5 Quick start The USB device HID Generic examples are available in Atmel AVR Studio 5 and ASF. Hereunder is the procedure to start a USB device HID Generic class example quickly: 1. Connect the board (for example the Atmel EVK1101 kit) to the PC using the USB cable. 2. Connect the Atmel debugger (hereafter the JTAGICE 3) to program the device. 3. Power selection switch must be set to the VBUS position. Figure 5-1. Board configuration. USB connector Power selection switch JTAG interface 4 Atmel AVR4905

Atmel AVR4905 4. Start Atmel AVR Studio 5 or later and click on New Example Project from ASF. In the New Example Project s list, select USB Device HID Generic Example based on the board you are using. The filter list can be used to find the example quickly (that is, use the HID keyword). 1 2 3 4 NOTE 5.1 Demo behavior 5. Compile, load and execute. The project does not require any modification and only needs to be compiled, loaded and run. Connect the Atmel debugger supported by the board and press F5. Since the HID Generic is using the native driver, the device install is silent. Now, since the device is enumerated, you can start the demo: 1. A PC application is available in: http://www.atmel.com/dyn/resources/prod_documents/avr153.zip. Download and unzip the file. 2. From the ExeDemo folder launch the UsbHidDemoCode.exe application. 3. Modify the PID to 2402 as shown below and click on the OK button. 5

Figure 5-2. PC application. NOTE 1. Use the LED 2 ON/OFF and LED 3 ON/OFF buttons to turn ON and OFF the LED 2 and 3 of the EVK1101 (if you are using different board, please refer to the ASF Example Project Help). 2. Push and release the buttons PB0 and PB1 to see the status displayed on the PC application window. The Firmware upgrade button is used to disconnect the device from the USB bus 6 Atmel AVR4905

Atmel AVR4905 5.1.1 Hardware behavior During the application execution the hardware (used board) should behave as below (LED number depends on the used board): A LED is on when USB device is in active mode and is off in SUSPEND mode A LED blinks showing that HID Generic interface is enabled by the USB Host LEDs are switched ON/OFF using the PC application. NOTE The user interface description (specific to the board) is defined at the end of ui.c source file. 7

6 Example description 6.1 Example content The ASF provides a USB device HID Generic class example for various Atmel AVR products. All these examples share common files and implement the same application. The Table 6-1 introduces a summary of the main files included in the USB device HID Generic example. These files are associated to the modules described in Figure 3-1. Table 6-1. USB device HID Generic example files. Modules Files ASF paths Description Application main.c ui.c conf_usb.h Examples folder Main loop. Set up hardware switches and LEDs to show operations. USB device configuration. UDI GENERIC UDC UDD udi_hid_generic.c/h common/services/usb/class/hid/device/generic/ HID Generic implementation udi_hid_genericdesc.c USB Descriptors for an USB device udi_hid_generic_conf.h common/services/usb/class/hid/device/generic/ with HID Generic interface (not applicable for USB composite device) udc.c/h udc_desc.h udi.h udd.h common/services/usb/udc/ USB device Core usb_protocol.h usb_atmel.h common/services/usb/ USB Protocol constants usbb_device.c/h usbc_device.c/h usb_device.c/h avr32/drivers/usbb/ avr32/drivers/usbc/ xmega/drivers/usb/ USB Drivers 8 Atmel AVR4905

Atmel AVR4905 6.2 Example behavior The main.c and ui.c files implement the user interface HID Generic application. It is based on three steps: 1. Start USB device: udc_start(); udc_attach(); // Must be called when the USB cable is plugged // Cable plugged is detected via VBus events 2. Wait the enable of HID Generic interface via call-back and enable the loopback process: UDI_HID_GENERIC_ENABLE_EXT() // Interface enabled callback 3. Scan buttons and manage LEDs according to the host request: //When button 0 changes status, send the report to the host if (b_btn_state!= btn0_last_state) { ui_hid_report[0] = b_btn_state; udi_hid_generic_send_report_in(ui_hid_report); btn0_last_state = b_btn_state; } //Turn ON/OFF the LEDs according to the host report UDI_HID_GENERIC_SET_FEATURE(report) { if (report[0]=='1') { // A led must be on switch(report[1]) { case '2': LED_On(LED2); break; case '3': LED_On(LED3); break; } } 9

Figure 6-1. Example behavior sequence. Application UDC / UDI / UDD Step 1 Start the USB device Startup udc start() VBus high udc attach() Step 2 - Wait for the HID Generic interface to be enabled Enable buttons scan and LEDs management UDI_HID_GENERIC_ENABLE_EXT() Enumeration Step 3 - HID reports management Turn ON/OFF LEDs Scan switches Send IN report UDI_HID_GENERIC_REPORT_OUT() UDC_SOF_EVENT() udi_hid_generic_send_report_in() Report OUT SOF Set feature management Run specific application feature UDI_HID_GENERIC_SET_FEATURE() Set feature Manage power consumption in suspend mode UDC_SUSPEND_EVENT() Turn off external components UDC_RESUME_EVENT() Turn on external components Suspend Resume SOF 10 Atmel AVR4905

Atmel AVR4905 7 Building a USB device HID Generic The USB device HID Generic modules provide a USB HID Generic interface which can be used to build a USB application. These modules are available in Atmel AVR Studio 5 and can be imported in an AVR Studio 5 project. This section describes how to add a USB device HID Generic in a project: 1. Import USB HID Generic module. 2. Configure personal USB parameters. 3. Call USB routines to run USB device. 7.1 Import USB module To import the USB HID mouse module, follow the instructions below: 1. Open or create your project. 2. From the Project menu, choose ASF Wizard. 3. Services (1), choose USB HID Generic (Single Interface Device) (2), and click on the Add to selection button (3). 1 2 3 11

7.2 USB configuration All USB stack configurations are stored in the conf_usb.h file in the application module. These configurations are simple and do not require any specific USB knowledge. There is one configuration section for each USB modules: UDC, UDI and UDD. The UDC configuration possibilities are described in the Atmel AVR4900: ASF USB Device Stack application note in the Section 7.1.1: USB device configuration. The UDD configuration possibilities are described in the Atmel AVR4900: ASF USB Device Stack application note in the Section 7.1.3: USB drivers configuration. The UDI which is the HID Generic interface require some configuration described in Table 7-1. Table 7-1. UDI HID Generic configuration. Define name Type Description UDI_HID_GENERIC_ENABLE_EXT Call-back function Call-back function called when HID Generic interface is enabled UDI_HID_GENERIC_DISABLE_EXT Call-back function Call-back function called when HID Generic interface is disabled UDI_HID_GENERIC_REPORT_OUT Call-back function Call-back function called when OUT report request is received UDI_HID_GENERIC_SET_FEATURE Call-back function Call-back function called when a set feature request is received UDI_HID_REPORT_IN_SIZE UDI_HID_REPORT_OUT_SIZE UDI_HID_REPORT_FEATURE_SIZE Constant Report IN size (send through the EP IN) Report OUT size (send through the EP OUT) Set Feature report size (send through the endpoint 0) NOTE 7.3 USB implementation 7.3.1 USB device control It is important to verify the configuration defined in conf_clock.h file, because the USB hardware requires a specific clock frequency (see comment in conf_clock.h file). This section describes source code to add to run a USB device HID Generic application. The implementation is made of three steps: 1. Start USB device. 2. Wait the enable of HID Generic interface by the Host. 3. Transfer data on USB bus. Only two function calls are needed to start a USB device application, see Figure 7-1. 12 Atmel AVR4905

Atmel AVR4905 Figure 7-1. USB device application sequence. To start a USB device application udc_start() no VBus monitoring available udc_include_vbus_monitoring() yes Wait for VBUS power UDC_VBUS_EVENT() no yes Enable D+ pull-up resistors udc_attach() Bus enumeration NOTE In case of a new project, the USB stack requires to enable interrupts and to initialize the clock and sleepmgr services. Example: <conf_usb.h> #define UDC_VBUS_EVENT(b_vbus_high) \ vbus_event(b_vbus_high) <main C file>: main() { // Authorize interrupts irq_initialize_vectors(); cpu_irq_enable(); // Initialize the sleep manager service sleepmgr_init(); // Initialize the clock service sysclk_init(); // Enable USB Stack device udc_start(); if (!udc_include_vbus_monitoring()) { // VBUS monitoring is not available on this product 13

} } // thereby VBUS has to be considered as present vbus_event (true); vbus_event(b_vbus_high) { if (b_vbus_high) { // Connect USB device udc_attach(); }else{ // Disconnect USB device udc_detach(); } } 7.3.2 USB interface control After the device enumeration (detecting and identifying USB devices), the USB Host starts the device configuration. When the USB HID Generic interface is accepted, the USB host enables this interface and the UDI_HID_GENERIC_ENABLE_EXT() callback function is called. When the USB device is unplugged or is reset by USB Host, the USB interface is disabled and the UDI_HID_GENERIC_DISABLE_EXT() callback function is called. Example: <conf_usb.h> #define UDI_HID_GENERIC_ENABLE_EXT() \ Hid_generic_enable() #define UDI_HID_GENERIC_DISABLE_EXT() \ Hid_generic_disable() <user C file>: Hid_generic_enable() { // Start an ADC conversion return true; } Hid_generic_disable() { // Stop the ADC conversion } 14 Atmel AVR4905

Atmel AVR4905 7.3.3 USB HID Generic functions 7.4 HID Generic and USB Host support The USB HID Generic class functions described in Table 7-2 allows to send or to receive data. Table 7-2. UDI HID Generic data functions. Declaration Description udi_hid_generic_send_report_in() Sent a report to the host #define UDI_HID_GENERIC_REPORT_OUT(report) Get the report data sent by the host #define UDI_HID_GENERIC_SET_FEATURE(report) Get the Feature report data sent by the host Even if the HID class is natively supported by Windows, an interface has to be created to interface with the drivers. To reduce the time of development, Atmel offers a DLL which provides functions to communicate with the HID Generic device. For further information regarding this DLL and how to use it to create a PC application, please refer to the application note USB PC Drivers Based on Generic HID Class available via this link: http://www.atmel.com/images/doc7645.pdf 15

8 HID Generic class in a USB composite device 8.1 USB configuration The information required to build a composite device is available in the Atmel AVR4902 ASF - USB Composite Device application note. A familiarity with this application note is mandatory. This section introduced only the specific information required to build a composite device with a HID Generic class interface. In addition to the USB configuration described in Section 7.2, the following values must be defined in the conf_usb.h file: USB_DEVICE_EP_CTRL_SIZE Endpoint control size. This must be: 8, 16, 32, or 64 for full speed device (8 is recommended to save RAM) 64 for a high speed device UDI_HID_GENERIC_EP_IN IN interrupt endpoint number used by the HID Generic interface. UDI_HID_GENERIC_EP_OUT OUT interrupt endpoint number used by the HID Generic interface. UDI_HID_GENERIC_IFACE_NUMBER Interface number of the HID Generic interface. USB_DEVICE_MAX_EP Total number of endpoints in the application. This must include the number of endpoints used by HID Generic interface. 16 Atmel AVR4905

Atmel AVR4905 8.2 USB descriptor The USB device Descriptor of composite device, defined in conf_usb.h file, must include a HID Generic interface: //! Define structure of composite interfaces descriptor #define UDI_COMPOSITE_DESC_T \ udi_hid_generic_desc_t udi_hid_generic; \... //! Fill composite interfaces descriptor for Full Speed #define UDI_COMPOSITE_DESC_FS \.udi_hid_generic = UDI_HID_GENERIC_DESC_FS, \... //! Fill composite interfaces descriptor for High Speed #define UDI_COMPOSITE_DESC_HS \.udi_hid_generic = UDI_HID_GENERIC_DESC_HS, \... //! Fill Interface APIs corresponding at interfaces descriptor #define UDI_COMPOSITE_API \ &udi_api_hid_generic, \... 17

9 Table of contents Features... 1 1 Introduction... 1 2 Abbreviations... 2 3 Overview... 3 4 HID Generic solution introduction... 4 5 Quick start... 4 5.1 Demo behavior... 5 5.1.1 Hardware behavior... 7 6 Example description... 8 6.1 Example content... 8 6.2 Example behavior... 9 7 Building a USB device HID Generic... 11 7.1 Import USB module... 11 7.2 USB configuration... 12 7.3 USB implementation... 12 7.3.1 USB device control... 12 7.3.2 USB interface control... 14 7.3.3 USB HID Generic functions... 15 7.4 HID Generic and USB Host support... 15 8 HID Generic class in a USB composite device... 16 8.1 USB configuration... 16 8.2 USB descriptor... 17 9 Table of contents... 18 18 Atmel AVR4905

Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 www.atmel.com Atmel Asia Limited Unit 01-5 & 16, 19F BEA Tower, Milennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369 Atmel Munich GmbH Business Campus Parkring 4 D-85748 Garching b. Munich GERMANY Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621 Atmel Japan 16F, Shin Osaki Kangyo Bldg. 1-6-4 Osaki Shinagawa-ku Tokyo 104-0032 JAPAN Tel: (+81) 3-6417-0300 Fax: (+81) 3-6417-0370 2012 Atmel Corporation. All rights reserved. Atmel, Atmel logo and combinations thereof, AVR, AVR Studio, and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Windows and others are registered trademarks or trademarks of Microsoft Corporation in U.S. and or other countries. Other terms and product names may be trademarks of others. Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.