Microchip® Advanced Software Framework

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

Human interface on SAM4L8 Xplained Pro:

Introduction

This example shows how to implement a USB Device HID Generic on Atmel MCU with USB module. The application note AVR4905 http://ww1.microchip.com/downloads/en/AppNotes/doc8499.pdf 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 (EVKxx,Xplain,...) 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 graphical interface, and the button Firmware Upgrade only disconnects the USB device.

  • LED0 blinks when USB host has checked and enabled HID generic interface
  • HID events LED1 can make LED0 always on or blinking
  • Event buttons are linked to SW0.

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
    • specific implementation for each target "./examples/product_board/":
      • conf_foo.h configuration of each module
      • ui.c implement of user's interface (buttons, leds)