Atmel AVR262 Application Note
Atmel AVR262 Application Note

Atmel AVR262 Application Note

Atmel qtouch with usb hid

Advertisement

Quick Links

Atmel AVR262: Atmel QTouch with USB HID

Features

• Single-chip solution
®
®
- Atmel
QTouch
and USB HID on the Atmel AVR
• Using QTouch Library
- Eight QTouch keys
- Customized firmware using the Atmel QTouch Library
• Easy portability for different AVR USB devices
• Supports IAR™ and GCC

1 Introduction

This application note illustrates how to use the
AT90USB646
microcontroller to provide a single-chip solution for QTouch sensing
through a USB interface. Touch sensor status is acquired and reported over the
USB HID class to a host PC.
Figure 1-1. Block diagram.
®
AT90USB646
QTouch Library
8-bit Atmel
Microcontrollers
Application Note
on the
Rev. 8375A-AVR-03/11

Advertisement

Table of Contents
loading

Summary of Contents for Atmel AVR262

  • Page 1: Features

    Atmel AVR262: Atmel QTouch with USB HID Features 8-bit Atmel Microcontrollers • Single-chip solution ® ® ® - Atmel QTouch and USB HID on the Atmel AVR AT90USB646 • Using QTouch Library - Eight QTouch keys Application Note - Customized firmware using the Atmel QTouch Library •...
  • Page 2: Hardware Requirements

    2 Hardware requirements • ® Atmel STK 600, Atmel STK525, or custom board • Atmel QTouch sensor board • USB host Atmel AVR262 8375A-AVR-03/11...
  • Page 3: Application Overview

    Atmel AVR262 3 Application overview This demo application acquires the QTouch key sensed, generates the report, and sends it to a PC (host) on request. The application is built over the generic USB HID application, which allows a simple data exchange between the PC (host) and the device.
  • Page 4 When a touch is sensed on a sensor connected to PA0/PA1, the value of the report byte is 0x01, and when it is sensed at PC4/PC5 the value is 0x40. The report byte values for the remaining sensors are treated similarly. Atmel AVR262 8375A-AVR-03/11...
  • Page 5: Touch Library Integration

    (which are device and compiler specific) need to be integrated with other source files. To select the correct device and application-specific library files, refer to the Library_Selection_Guide.xls file in the Atmel QTouch library root folder. The library selection guide is also available on the Atmel website.
  • Page 6: Compiler And Assembler Options

    Project Options, select the C/C++ Compiler category, and on the Preprocessor tab, the following options should be provided, as shown in Figure 5-2. The same options should be added in the Assembler category on the Preprocessor tab, as shown in Figure 5-3. Atmel AVR262 8375A-AVR-03/11...
  • Page 7 Atmel AVR262 Figure 5-2. IAR compiler options. Figure 5-3. IAR assembler options. 8375A-AVR-03/11...
  • Page 8: Firmware

    The various related functions can be grouped into three main categories. The necessary functions are explained under each relevant category. • Functions related to initialization • Touch library APIs • HID report generation Atmel AVR262 8375A-AVR-03/11...
  • Page 9: Functions Related To Initialization

    CHANNEL_6, AKS_GROUP_1, 10u, HYST_6_25 ); qt_enable_key( CHANNEL_7, AKS_GROUP_1, 10u, HYST_6_25 ); Refer to the Atmel QTouch user guide for more information on this function. 6.1.6 qt_init_sensing The qt_init_sensing function is used to initialize the touch sensing for all enabled channels.
  • Page 10: Touch_Init_Hid

    = 0u; uint16_t burst_flag = 0u; if( time_to_measure_touch ) clear flag: it's time to measure touch time_to_measure_touch = 0u; one time measure touch sensors status_flag = qt_measure_sensors( current_time_ms_touch ); burst_flag = status_flag & QTLIB_BURST_AGAIN; }while ( burst_flag) ; Atmel AVR262 8375A-AVR-03/11...
  • Page 11: Hid Report Generation

    Atmel AVR262 6.3 HID report generation 6.3.1 hid_report_in Whenever the host requests data, the device responds accordingly. If there is no new data, the device sends a NAK response. When new data is available, the device needs to send the information to the host. This function is responsible for generating the report to be sent via USB.
  • Page 12: Host Application

    This application note includes a GUI-based PC host application that can be used to display which key is pressed or released. The PC executable is available in the associated deliverables. The respective key press or key release is displayed as shown in Figure 7-1. Figure 7-1. Key status. Atmel AVR262 8375A-AVR-03/11...
  • Page 13: Related Items

    • Atmel AT90USB646 series datasheet: http://www.atmel.com/dyn/products/product_card.asp?part_id=3877 • Atmel AVR Studio ® http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725 • Atmel AVR QTouch Library 4.3: http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4627 • Atmel AVR QTouch Library User Guide: http://www.atmel.com/dyn/resources/prod_documents/doc8207.pdf • AVR328: USB Generic HID Implementation on megaAVR ® devices http://www.atmel.com/dyn/resources/prod_documents/doc7599.pdf • AVR1511: QT600-ATxmega128A1 Training Guide http://www.atmel.com/dyn/resources/prod_documents/doc8350.pdf...
  • Page 14: Table Of Contents

    6.1.7 qt_set_parameters ....................9 6.1.8 touch_init_HID......................10 6.2 Touch library APIs ..................... 10 6.2.1 touch_measure......................10 6.3 HID report generation..................11 6.3.1 hid_report_in ......................11 7 Host application ................12 8 Related items.................. 13 9 Table of contents ................14 Atmel AVR262 8375A-AVR-03/11...
  • Page 15 Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL...

Table of Contents