Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ASF USB Composite Device Example HID mouse and MSC

Human interface on SAMD21-XPlain:

Introduction

This example shows how to implement a USB Composite Device with HID mouse and Mass Storage interfaces on Atmel MCU with USB module.

Startup

The example uses all memories available on the board and connects these to USB Device Mass Storage stack. Also, 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 allows to display all available memories as a removable disks and provides a mouse in the Unix/Mac/Windows operating systems.

Note
This example uses the native MSC and HID drivers on Unix/Mac/Windows OS, except for Win98.
  • Led 0 blinks when USB is connected and enabled Mouse and MSC interface
  • Push button 0 (SW0) are used to move mouse up
  • Only a low level on push button 0 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 & MSC modules:
    services/usb/
    services/usb/udc/
    services/usb/class/msc/
    services/usb/class/hid/
    services/usb/class/hid/mouse/
  • Specific implementation:
    • main.c,
      initializes clock
      initializes interrupt
      manages UI
    • udi_composite_desc.c,udi_composite_conf.h,
      USB Composite Device definition
    • specific implementation for each target "./examples/product_board/":
      • conf_foo.h configuration of each module
      • ui.c implement of user's interface (buttons, leds)

1 The memory data transfers are done outside USB interrupt routine. This is done in the MSC process ("udi_msc_process_trans()") called by main loop.