Microchip® Advanced Software Framework

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

Human interface on STK600:

Introduction

This example shows how to implement a USB Device HID Keyboard on Atmel MCU with USB module. The application note AVR4904 http://ww1.microchip.com/downloads/en/appnotes/doc8446.pdf provides information about this implementation.

Startup

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

  • Led 0 is on when USB line is in IDLE mode, and off in SUSPEND mode
  • Led 1 blinks when USB host has checked and enabled HID Keyboard interface
  • Led 2 displays numeric lock status.
  • Led 3 displays caps lock status.
  • The switch 0 open a note pad application on Windows O.S. and send key sequence "Atmel AVR USB Keyboard"
  • The switch 0 can be used to wakeup USB Host in remote wakeup mode.

Setup for STK600:

  • LEDS connector is connected to PORTA
  • SWITCHES are connected to PORTB
  • Warning! The AREF0 jumper must be removed because AREF0 connected on PORTA0 overrides led 0.
  • Warning! The AREF1 jumper must be removed because AREF1 connected on PORTB0 overrides switch 0.

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/keyboard/
  • 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)