Microchip® Advanced Software Framework

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

Human interface on SAM4S-EK:

Introduction

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

Startup

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

  • Led 0 (D2) blinks when USB host has checked and enabled HID Mouse interface
  • No mouse buttons are linked
  • USRPB1 (BP2) and USRPB2 (BP3) are used to move mouse left and right
  • Only a low level on J13.PA15 will generate a wakeup to 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/mouse/
  • 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)