Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ASF USB Device HID Generic

Human interface on XMEGA-A3BU Xplained:

Introduction

This example shows how to implement a USB Device HID Generic on XMEGA-A3BU Xplained that uses QTouch key. The application note AVR1632 provides information about this implementation.

Startup

The example uses the buttons or sensors available on the board to simulate a standard generic. After loading firmware, connect the board to the USB Host. When connected to a USB host system this application provides a HID generic application in the Unix/Mac/Windows operating systems. This example uses the native HID driver for these operating systems.

A Atmel PC tool allows to communicate with the HID generic device. This document gives information on integrating the Atmel USB HID DLL functions. Simple code examples that demonstrate different types of implementation are given. http://ww1.microchip.com/downloads/en/AppNotes/doc7645.pdf The PC tool is available here: http://ww1.microchip.com/downloads/en/AppNotes/AVR153.zip Note: Use the PID 0x2402 in tool graphic interface, and the button Firmware Upgrade only disconnects the USB device.

  • Led 0 is on when USB line is in IDLE mode, and off in SUSPEND mode
  • Led 1 blinks when USB Host have checked and enabled HID generic interface
  • Green LED close to USB connector is on linked on HID events LED 2
  • Red LED close to USB connector is linked on HID events LED 3
  • Event buttons are linked to switches CS0, CS1, CS2 and CS3 (CS3 = QTouch button managed by XMEGA QTouch library)
  • All switches can be used to wakeup USB Host in remote wakeup mode.

About example

The example uses the following module groups:

  • Basic modules: Startup, board, clock, interrupt, power management
  • USB Device stack and HID modules:
    services/usb/
    services/usb/udc/
    services/usb/class/hid/
    services/usb/class/hid/generic/
  • Specific implementation:
    • main.c,
      initializes clock
      initializes interrupt
      manages UI
    • touch.c
      initializes touch
      initializes timer to measure touch periodically
      provides status of QTouch key
    • specific implementation for each target "./examples/product_board/":
      • conf_foo.h configuration of each module
      • ui.c implement of user's interface (QTouch key, buttons, leds)