ATAVRTS2080B Atmel, ATAVRTS2080B Datasheet
![BOARD EVAL FOR ATTINY88 LIBRARY](/photos/9/18/91800/atavrts2080b_sml.jpg)
ATAVRTS2080B
Specifications of ATAVRTS2080B
Related parts for ATAVRTS2080B
ATAVRTS2080B Summary of contents
Page 1
... Atmel QTouch Library User Guide ® ® Supports QTouch and QMatrix acquisition for Keys, Sliders and Rotors Rev. 8207J-AT42-02/11 ...
Page 2
Table of Contents Table of Contents................................................................................................2 1 Preface...........................................................................................................9 2 Introduction .................................................................................................10 3 Overview ......................................................................................................10 4 Abbreviations and Definitions ...................................................................11 4.1 Definitions........................................................................................................................ 11 5 Generic QTouch Libraries ..........................................................................12 5.1 Introduction...................................................................................................................... 12 5.2 Acquisition Methods ........................................................................................................ 13 5.2.1 QTouch acquisition method....................................................................................................13 5.2.1.1 ...
Page 3
Public Functions.....................................................................................................................27 5.6.5.1 qt_set_parameters............................................................................................ 27 5.6.5.2 qt_enable_key .................................................................................................. 28 5.6.5.3 qt_enable_rotor................................................................................................. 28 5.6.5.4 qt_enable_slider ............................................................................................... 29 5.6.5.5 qt_init_sensing.................................................................................................. 29 5.6.5.6 qt_measure_sensors ........................................................................................ 30 5.6.5.7 ...
Page 4
Debug Support in the sample applications for EVK2080 and QT600 boards 71 5.6.11.6.2 How to turn on the debug option ................................................................ 71 5.6.11.6.3 Debug Interface if USB Bridge board is not available ................................ 72 5.7 Library Variants ............................................................................................................... 72 ...
Page 5
QTouch Library for AT32UC3L devices ........................................................................ 106 6.3.1 Salient Features of QTouch Library for UC3L ......................................................................106 6.3.1.1 QMatrix method sensor .................................................................................. 106 6.3.1.2 QTouch method sensor .................................................................................. 106 6.3.1.3 Autonomous QTouch sensor.......................................................................... 106 6.3.1.4 Additional Features......................................................................................... 107 6.3.2 Device ...
Page 6
Autonomous QTouch method Enable and Disable Sensor for UC3L ............ 124 6.3.10 Raw acquisition mode support for UC3L ..............................................................................125 Figure 45 Raw acquisition mode API Flow diagram ..................................................... 125 6.3.11 Library Configuration parameters for UC3L..........................................................................126 Table 13 QTouch Library ...
Page 7
Public Functions of QTouch Library for UC3L ......................................................................145 6.3.17.1 QMatrix API .................................................................................................... 145 6.3.17.1.1 touch_qm_sensors_init............................................................................. 145 ...
Page 8
API Flow diagram for ATtiny20.............................................................................................161 Figure 49 Linker configuration options for Tiny20......................................................... 161 Figure 50 QTouch method for Tiny20 API Flow diagram ............................................. 162 6.4.5 QTouch Library configuration parameters for ATtiny20........................................................162 Table 18 QTouch Library for ATtiny20 Configuration parameters ...
Page 9
... QTouch libraries. This guide is a functional description of the library software, its programming interface and it also describes its use on the supported reference systems. Use of this software is bound by the Software License Agreement included with the Library. Related documents from ATMEL Documents related to QTouch capacitive sensing solutions from ATMEL are • TS2080A/B data sheet. • ...
Page 10
... Introduction ATMEL QTouch Library is a royalty free software library (available for GCC and IAR compiler tool chains) for developing touch applications on standard AVR and SAM microcontrollers. Customers can link the library into their applications in order to provide touch sensing capability in their projects. The Library can be used to develop single chip solutions for control applications which have touch sensing capabilities develop standalone touch sensing solutions which interface with other host or control devices ...
Page 11
... ARM: refers to a device in the ATSAM ARM® basedmicrocontroller family. • ATMEL QTouch Library: The combination of libraries for both touch sensing acquisition methods (QTouch and QMatrix). • QTouch Technology: A type of capacitive touch sensing technology using self capacitance - each channel has only one electrode. ...
Page 12
... SNSK pins are available on distinct ports. 5 Generic QTouch Libraries 5.1 Introduction ATMEL QTouch provides a simple to use solution to realize touch sensing solutions on a range of supported ATMEL AVR Microcontrollers. The QTouch libraries provide support for both QTouch and QMatrix acquisition methods. Touch sensing using QMatrix or QTouch acquisition methods can be added to an application by linking the appropriate ATMEL QTouch Library for the AVR Microcontroller and using a simple set of API to define the touch channels and sensors and then calling the touch sensing API’ ...
Page 13
... NOTE recommended to keep the size of the keys larger than 6mmx6mm to ensure reliable and robust measurements, although actual key design requirements also depend on panel thickness and material. Refer to the ATMEL Capacitive touch sensor design guide for details. QTouch acquisition method can be used in two ways • ...
Page 14
Sensor schematics for a QTouch acquisition method design Figure 5-3 : Schematics for a QTouch acquisition method design 5.2.2 QMatrix acquisition method QMatrix devices detect touch using a scanned passive matrix of electrode sets. A single QMatrix device can ...
Page 15
... QMatrix charge transfer is labeled as the Y line. QMatrix circuits offer good immunity to moisture films, extreme levels of temperature stability, superb low power characteristics, and small IC package sizes for a given key count. 5.2.3 Sensor schematics for a QMatrix acquisition method design Atmel MCU X0 Xn Y0A YmA ...
Page 16
For example, if recalibration threshold (one of the global settings) of QMatrix acquisition method is set as 1, all QMatrix sensors will have recalibration threshold of 1. 5.3.1 Recalibration Threshold Recalibration threshold is the level above which automatic recalibration occurs. ...
Page 17
This feature is useful in cases of high density keypads where touching a key or floating a finger over the keypad would cause untouched keys to drift, and therefore create a sensitivity shift, and ultimately inhibit any touch detection. Setting ...
Page 18
Setting Variable name Negative Drift qt_neg_drift_rate Positive Drift qt_pos_drift_rate 5.3.6 Positive Recalibration Delay If any key is found to have a significant drop in signal delta, (on the negative side deemed error condition. If this ...
Page 19
Setting 50% of detect threshold value (HYST_50) • Setting ...
Page 20
... Using the Sensors 5.5.1 Avoiding Cross-talk In ATMEL QTouch library variants that use QTouch acquisition technology, adjacent sensors are not measured at the same time. This prevents interference due to cross-talk between adjacent channels, but at the same time some sensor configurations take longer to measure than others. ...
Page 21
... However, the user is allowed to run time- critical section (not more than few instructions) of the host application comprising on the touch sensing timing. 5.6 QTouch API and Usage The Atmel QTouch library provides support for many devices. This chapter explains the touch library for such devices without any hardware support. 5.6.1 ...
Page 22
SENSOR_TYPE_KEY SENSOR_TYPE_ROTOR SENSOR_TYPE_SLIDER 5.6.3.2.2 aks_group_t Enumeration aks_group_t Defines the Adjacent Key Suppression (AKS) groups each sensor may be Use associated with ( see section AKS is selectable by the system designer 7 AKS groups are supported by the library Values ...
Page 23
HYST_x = hysteresis value is x percent of detection threshold value (rounded down). Note that a minimum value used as a hard limit. Example: if detection threshold = 20, then: HYST_50 = 10 (50 percent of 20) ...
Page 24
Values Comment RECAL_100 100% recalibration threshold RECAL_50 50% recalibration threshold RECAL_25 25% recalibration threshold RECAL_12_5 12.5% recalibration threshold RECAL_6_25 6.25% recalibration threshold 5.6.4 Data structures This section lists the data structures that hold sensor status, settings, and diagnostics information 5.6.4.1 ...
Page 25
Structure qt_touch_lib_config_data_t Input / Output Input to the library Use Global Configuration data settings for the library. Fields Type qt_recal_threshold recal_threshold_t qt_di uint8_t qt_drift_hold_time uint8_t qt_max_on_duration uint8_t qt_neg_drift_rate uint8_t qt_pos_drift_rate uint8_t qt_pos_recal_delay uint8_t The measurement limit for touch ...
Page 26
This data structure is used to specify the burst lengths for each of the QMatrix channels Fields Type Comment qt_burst_lengths[] uint8_t The burst length for each of the QMatrix channel in units of pulses. Default value: 64 pulses. These values ...
Page 27
B15:B8 lib_sig_lword uint16_t Holds the general information about the library Bit fields B10 B15 : B11 lib_sig_hword uint16_t Reserved qt_lib_siginfo_t structure definitions for a QMatrix acquisition method ...
Page 28
Arguments Type Comment Void - This function will initialize the parameters required by the library to default values .But the default values can be changed by the user by modifying the global threshold values as ...
Page 29
The rotor / slider number depends on the order in which the rotor or sliders are enabled. The first rotor or slider enabled will use “rotor_slider_values[0]”, the second will use “rotor_slider_values[1]”, and so on. The reported rotor value is ...
Page 30
NOTE: • All sensors must be qt_enable_slider ) before calling this function. • This functions initializes all the configured sensors, performs calibration. 5.6.5.6 qt_measure_sensors This function performs a capacitive measurement on all enabled sensors. The measured signals for each sensor ...
Page 31
Arguments Type Comment Void - - NOTE: • Recalibration may be useful if, for example desired to globally recalibrate all sensors on a change in application operating mode. • This function must be called ...
Page 32
The function qt_measure_sensors() should have been called at least once prior to calling this function. 5.6.6 Sequence of Operations and Using the API Figure 6 illustrates the sequence of operations required to be performed to add touch to an ...
Page 33
SNS1 and SNSK1 are available on different ports and the other 8 channels with 8 pins are available on a different pair ...
Page 34
Figure 5-6: Sequence of operations to add Touch capability 34 8207J-AT42-02/11 ...
Page 35
Channel numbering when routing SNS and SNSK pins to different ports Figure 5-7 illustrates a sample QTouch capacitive sensing solution which uses four ports (two port pairs ) on a device for routing the SNS and SNSK lines required. ...
Page 36
Figure 5-7 : channel numbering for QTouch acquisition method when the SNS and SNSK pins are connected to different ports. 5.6.6.1.1.2 Channel numbering when routing SNS and SNSK pins to different ports with pin configurability When SNS and SNSK pins ...
Page 37
SNS and SNSK pins are configured with few rules keeping in mind as illustrated in section Pins A0 ,A1,A4 and A6 of PORT A are SNS pins and pins B2,B3,B5,B7 are SNSK pins of PORT B. Channel 0 will be ...
Page 38
Channel 1 will be forming a SNS-SNSK pair as A3A4 Channel 2 will be forming a SNS-SNSK pair as A5A7. The channel numbering is not dependent on the pin numbering. 5.6.6.1.2 Channel numbering when using QMatrix acquisition method Figure 5-9 ...
Page 39
Table 1 : Channel numbers for QMatrix configurations Line label 4 8 channel channel configur configurat ation ion ( Channel 0 X0Y0 X0Y0 Channel 1 X1Y0 X1Y0 Channel 2 X2Y0 X2Y0 Channel 3 X3Y0 X3Y0 ...
Page 40
Channel 52 N/A N/A Channel 53 N/A N/A Channel 54 N/A N/A Channel 55 N/A N/A Channel 56 N/A N/A Channel 57 N/A N/A Channel 58 N/A N/A Channel 59 N/A N/A Channel 60 N/A N/A Channel 61 N/A N/A ...
Page 41
... Filtering Signal Measurements The ATMEL QTouch Library API provides a function pointer called “qt_filter_callback”. The user can use this hook to apply filter functions to the measured signal values. If the pointer is non-NULL, the library calls the function after library has made capacitive channel measurements, but before the library has processed the channel information and determining the sensor states ...
Page 42
... The signal values processed by the ATMEL QTouch Library are now the mean of the last four actual signal values. 5.6.6.4 Allocating unused Port Pins for User Application The GPIO pins within a port that are not used for QTouch or QMatrix acquisition methods can be used for user application ...
Page 43
CHANNEL_2, CHANNEL_4, AKS_GROUP_1, 16u, HYST_6_25, RES_8_BIT enable a key on channel 6 */ qt_enable_key( CHANNEL_6, AKS_GROUP_2, 10u, HYST_6_25 ); /* enable a key on channel 7 */ ...
Page 44
If two port pairs are used for the design, all the channels for a sensor have to be connected on a single port pair. Combining channels from multiple ports is not possible when designing sensors. e. not ...
Page 45
The channels used for an individual rotor or slider should all be on the same Y line. • The maximum number of Rotors / Sliders supported by the QMatrix acquisition method depends on the configuration. Refer to the Library_Selection_Guide.xls ...
Page 46
... This section illustrates the key steps required in integrating the QTouch library in your application. 5.6.10.1 Directory structure of the library files The QTouch library directory structure is as listed below What Where Root Default directory is installation C:\Program Files\Atmel\Atmel_QTouch_Libraries_4.x\Generic_QTouch_Libraries Header file ..\include 46 Suitable Charge Cycle times (or) Suitable Dwell Cycle times (us cycles (1us to 2us) ...
Page 47
... Generic_QTouch_Libraries \AVR_Tiny_Mega_XMega\QMatrix\common_files 8-bit ..\Atmel_QTouch_Libraries_4.x\ devices Generic_QTouch_Libraries \AVR_Tiny_Mega_XMega\QTouch\lib rary_files UC3 ..\Atmel_QTouch_Libraries_4.x\ Generic_QTouch_Libraries \32bit_AVR\UC3\QTouch\library_files ATSAM ..\Atmel_QTouch_Libraries_4.x\ Generic_QTouch_Libraries \AT91SAM\SAM3\QTouch\library_file s ..\Atmel_QTouch_Libraries_4.x\ Generic_QTouch_Libraries \AVR_Tiny_Mega_XMega\QMatrix\library_files 8-bit ..\Atmel_QTouch_Libraries_4.x\ devices Generic_QTouch_Libraries \AVR_Tiny_Mega_XMega\QTouch\ex ample_projects UC3 ..\Atmel_QTouch_Libraries_4.x\ Generic_QTouch_Libraries \32bit_AVR\UC3\QTouch\example_pr ojects ATSAM ..\Atmel_QTouch_Libraries_4.x\ Generic_QTouch_Libraries\AT91SA M\SAM3\QTouch\library_files\exampl e_projects ..\Atmel_QTouch_Libraries_4.x\ Generic_QTouch_Libraries \AVR_Tiny_Mega_XMega\QMatrix\example_proj ects this directory.touch_api_2kdev ic ...
Page 48
... First step is to select the compiler tool chain to be used based on the code and data memory requirements. The list of supported compiler tool chains can be found in 5.7.1.2. Use the library selection guide (C:\ Program Files\Atmel\Atmel_QTouch_Libaries_4.x\ Library_Selection_Guide.xls) to select the QTouch acquisition method library variant required for the device. ...
Page 49
QT_DELAY_CYCLES _POWER_OPTIMIZATION_ (Required only for ATtiny and ATmega libraries. ATxmega and UC3 libraries by default optimized for power without any limitations) _TOUCH_ARM_ QTOUCH_STUDIO_MASKS _STATIC_PORT_PIN_CONF_ 4) Using QTouch API’s in your application to add touch functionality a. The clock, host ...
Page 50
UC3 devices – touch_api.h • ATSAM devices - touch_api.h and touch_qt_config.h 6) General application notes • The clock, host application and other peripherals needed by the host application needs to be initialized. • Ensure that there are no conflicts ...
Page 51
Given the above requirements for the applications, the first step is to select the right library variant required. Step 1: Selecting the right library variant Referring to the library selection guide, we see that there are a few variants of ...
Page 52
Number of SNS/SNSK port pairs needed Choice of ports available for the design Given the above requirements for the applications, the first step is to select the right library variant required. Step 1: Selecting the right library variant Referring to ...
Page 53
... Select the device from the list of supported devices listed in 5.7.2.4.1 2) Select the right library variant for the device selected from the selection guide available in C:\ Program Files\Atmel\Atmel_QTouch_Libaries_4.x\Library_Selection_Guide.xls Each variant supports a. a specific number of channels, b. Supports a specific configuration matrix pins ( for pins & pins ) c ...
Page 54
... The constant/symbol names are as listed in the table below c. The constant/symbol definitions can be placed in any of the following i. In the user’s ‘C’ file prior to include touch_api.h in the file ii. Defined user’s project options. iii. Modifying the defines in a touch_qm_config.h available in the path C:\Program Files\Atmel\Atmel_QTouch_Libraries_4.x\ Generic_QTouch_Libraries 54 \AVR_Tiny_Mega_XMega\QMatrix\common_files 8207J-AT42-02/11 ...
Page 55
Table 4 :List of configurable parameters for touch library usage. Symbol / Constant Range of values name _QMATRIX_ Symbol defined to indicate QMatrix acquisition method is required QT_NUM_CHANNELS The number of channels the library supports.( Possible values:4,8,16,32,56,64). Note: 56 channel ...
Page 56
... Include the “touch_api.h” header file and assembler source file from the QTouch library in your application. The touch_api.h can be found in the release package at C:\Program Files\Atmel\Atmel_QTouch_Libraries_4.x\ Generic_QTouch_Libraries \AVR_Tiny_Mega_XMega\QMatrix\common_files. The assembler files mentioned below could be found at the location C:\Program Files\Atmel\Atmel_QTouch_Libraries_4.x\ Generic_QTouch_Libraries \AVR_Tiny_Mega_XMega\QMatrix\common_ files a. qm_asm_tiny_mega.S in case of ATtiny and ATmega devices. b. qm_asm_xmega.S in case of ATxmega devices. ...
Page 57
Number of X lines Based on the number of channels, needed since 8 channels is needed lines are supported. NUM_X_LINES is 4 Number of Y lines Based on the number of channels, needed ...
Page 58
... Given the above requirements for the applications, the first step is to select the right library variant required. Step 1: Select the Device that suits the requirements based on the touch sensing channels needed from the library selection guide available at C:\ Program Files\Atmel\ Atmel_QTouch_Libaries_4.x\ Library_Selection_Guide.xls Step 2: From the Library_selection_Guide.xls list,, we see that there are a few variants of libraries supported for AT Tiny device ...
Page 59
The above definitions should be placed before including “touch_api.h” in your files. Alternatively, you can define these in your IDE’s project options or have them defined in a separate header. 3. These can also be modified in the touch_qm_config.h, ...
Page 60
In case of XMega devices, the resources are used internal to the library and hence cannot be used by the host application Analog Comparator0 on PORTA (AC0 on PORTA) o Timer/Counter1 on PORTC (TCC1) o Event System Channel0 (EVSYS_CH0) o ...
Page 61
QTouch Acquisition method Libraries : Stack usage for IAR compiler tool chain Configuration Single port pair - only keys ( channels ) Single port pair – keys/ rotors/ sliders (4/8 channel) Two port pairs - only keys ...
Page 62
Using the Sample projects The sample applications are shipped with the complete set of files required to configure, build and download the application for both IAR-workbench and AVR Studio IDE. Since more than one device may use the same ...
Page 63
Figure 5-11: Selecting the right configuration in the QTouch acquisition method example Figure 5-12 : Selecting the right configuration in QTouch acquisition method example applications in AVR-4 IDE 5.6.11.2.2 Changing the settings to match your device 5.6.11.2.2.1 Processor settings Once ...
Page 64
Figure 5-13 : Changing the processor settings for the examples in IAR IDE Figure 5-14 : Changing the processor settings for the examples in AVR-Studio 4 5.6.11.2.3 Changing the library configuration parameters The configuration parameters required for the library are ...
Page 65
SNS1 – SNSK1 & SNS2 – Section 5.7.1.5.2 has SNSK2 details on the range of values allowed QT_NUM_CHANNELS 4, 8, 12, 16 for tinyAVR, megaAVR and XMEGA device libraries and 8, 16, 32 for UC3 device libraries. _ROTOR_SLIDER_ Rotor / ...
Page 66
Figure 5-16 : Specifying the QTouch acquisition method library configuration parameters 5.6.11.2.4 Using the example projects The sample applications are shipped with the complete set of files required to configure, build, execute and test the application for both IAR-workbench and ...
Page 67
Internally there are two configurations for each device. • ALL KEYS configuration : Supports only keys • KEYS/ROTORS/SLIDERS configuration : Supports keys or rotors or sliders concurrently These configurations enable a set of stored options and a specific library to ...
Page 68
Figure 5-19 : Specifying QMatrix acquisition library parameters in IAR IDE project 68 8207J-AT42-02/11 ...
Page 69
Figure 5-20 : Specifying QMatrix acquisition library parameters in AVR Studio IDE project 5.6.11.3.3 Using the example projects The sample applications are shipped with the complete set of files required to configure, build, execute and test the application for both ...
Page 70
Figure 5-21 : Modifying the stack size in IAR IDE 5.6.11.5 Optimization levels The default configuration settings in sample projects which ship with the library are set to the highest level of optimization for IAR and GCC variants of the ...
Page 71
... The port and pins assigned for the QDebug protocol with the example projects are arbitrary and have to be changed based on the project configuration chosen and pin availability. A separate App note is available on the Atmel website (in QTouch libraries webpage) explaining the QT600 debug protocol. ...
Page 72
... QTouch Acquisition method library variants 5.7.1.1 Introduction Variants of the ATMEL QTouch Library based on QTouch Technology are available for a range of ATMEL Microcontrollers. This section lists the different variants available. By following a simple series of steps, the user can identify the right library variant to use in his application. ...
Page 73
Support for different compiler tool chains The QTouch acquisition method libraries are supported for the following compiler tool chains. Table 7 Compiler tool chains supported for QTouch acquisition method libraries Tool IAR Compiler for 8bit AVR IAR Embedded Workbench ...
Page 74
Support a maximum of 8 channels • Supports a maximum rotors / sliders. 5.7.1.3.2 Naming convention for libraries to be used with IAR Embedded Workbench The libraries are named according the naming convention listed below ...
Page 75
Maximum number of rotor / sliders supported NOTE: • For 8-bit devices, ports which have less than 8 pins cannot be used by the QTouch acquisition method libraries. Check the data sheet to determine the number of pins supported ...
Page 76
SNSK & SNS pins are on the same port, number of channels = 2 SNSK & SNS pins are on the same port, number of channels = 4 SNSK & SNS pins are on the same port, number of channels ...
Page 77
Tips on pin assignments for the sensor design using two pairs of SNS / SNSK ports This section lists tips on selecting the pin assignments when using a single port pair for the SNS and SNSK Pins. Design choice ...
Page 78
... QMatrix acquisition method library variants 5.7.2.1 Introduction Variants of the ATMEL QTouch Library based on Matrix™ acquisition technology are available for a range of ATMEL Microcontrollers. Refer to the library selection guide (C:\ Program Files\Atmel\ Atmel_QTouch_Libaries_4.x\Library_Selection_Guide.xls) for the list of devices currently supported for QMatrix. 5.7.2.2 Support for different compiler tool chains The QMatrix acquisition method libraries are supported for the following compiler tool chains ...
Page 79
ATxmega128A1 ATmega88PA) ATxmega64A3 v3xmsf (ATxmega16A4, ATxmega128A3, ATxmega16D4, ATxmega192A3, ATxmega32A4, ATxmega256A3, ATxmega32D4) ATxmega256A3B) v3xm (ATxmega64A3) v4xm(ATxmega64A1) v5xm(ATxmega128A3, ATxmega192A3, ATxmega256A3, ATxmega256A3B) v6xm(ATxmega128A1) v3g3 (ATmega165P, ATmega325P, ATmega645, ATmega164p, ATmega324p, ATmega324pa, ATmega644p, ATmega168p, ATmega328p, AT90CAN32, AT90CAN64 ) v3g5 ( AT90CAN128, AT90USB1286, AT90USB1287, ...
Page 80
AT90USB162 ) avrxmega2 (ATxmega16A4, ATxmega16D4, ATxmega32D4) avrxmega3 (ATxmega32A4) avrxmega4 (ATxmega64A3) avrxmega5(ATxmega64A1) avrxmega6(ATxmega128A3, ATxmega192A3, ATxmega256A3, ATxmega256A3B) avrxmega7(ATxmega128A1) avr5g3 (ATmega165P, ATmega325P, ATmega645, ATmega164p, ATmega324p, ATmega324p, ATmega644p, ATmega168p, ATmega328p, AT90CAN32, AT90CAN64 ) avr51g2 ( AT90CAN128, AT90USB1286, AT90USB1287, ATmega1280, ATmega1281 ) ...
Page 81
NRS 0,1,2,4,8 The table below provides a few examples of the naming convention. Example Library name libavr51g2_8qm_4x_2y_krs_2rs.a libavr25g1s1_16qm_8x_2y_k_0rs.r90 5.7.2.4 QMatrix acquisition method library variants 5.7.2.4.1 Devices supported for QMatrix Acquisition Refer to the Library_selection_guide.xls for the list of devices ...
Page 82
In case the macro QTOUCH_STUDIO_MASKS is not enabled in project space, SNS_array and SNSK_array are calculated internal to the library according to the configured sensors. Note: 1. Port pin configurability is enabled for the following configurations, 4- channel intraport configuration ...
Page 83
The first SNS port pin should always be mapped to the first SNSK port pin in any port pair. Similarly the second SNS port pin should always be mapped to second SNSK pin and so on. 4. Even sensors ...
Page 84
Example for 8 channel intraport mask Calculation with two port pairs X SNS1=PORTA Ch2 X SNSK1=PORTA SNS2=PORTB Ch5 X SNSK2=PORTB This example is for intraport 8 channel library with two port pair used. Channel0 is A1A3,Channel1 is A4A5 and ...
Page 85
Example for 12 channel intraport-interport mask Calculation with two port pairs X SNS1=PORTA Ch2 X SNSK1=PORTA SNS2=PORTB Ch5 X SNSK2=PORTD This example is for intraport-interport 12 channel library with two port pair used. Channel0 is A1A3,Channel1 is A4A5 and ...
Page 86
Example for 16 channel intreport-interport mask Calculation with two port pairs SNS1=PORTA PORT PAIR 1 Ch2 X SNSK1=PORTB SNS2=PORTC PORT PAIR 2 Ch5 SNSK2=PORTD This example is for interport-interport 16 channel library with two port pair used. Channel0 is ...
Page 87
Open AVR QTouch Studio .Enable the Design Mode Radio button on the left hand side of the screen. Figure 5-25 Selecting the Design mode in the AVR QTouch Studio File Menu option and click New Design. ...
Page 88
Figure 5-27: Creating New Design in the AVR QTouch Studio 3. After Creating Design, the new screen pops up which shows all the sensors which have been created. Figure 5-28: New Design Sensors in the AVR QTouch Studio virtual kit ...
Page 89
Now Go to Tools->Pin Configuration Wizard.Pin configuration Figure 5-29: Selecting the pin configuration wizard for theDesign 5. Pin configuration Window will pop up with the information on the usage of the tool. Click Next to proceed to the configuration. ...
Page 90
Select the MCU and click Next as shown below. Figure 5-31: Selecting the MCU for the New Design 7. Select the SNS and SNSK ports needs for the design and click Next. Figure 5-32: Selecting SNS and SNSK ports ...
Page 91
Select the pins used for the design and click Next If there is error in the selection of the pins (Ex: conflictin pins used), a red marker will be appear and the user cannot proceed to next step in ...
Page 92
Figure 5-34: Selecting the SNS and SNSK Port Pins in the new Design( Without Error) Once the pins are selected, Pin Wizard will provide the summary report .Check whether details are correct as specified.Click Next Figure 5-35: Summary report 92 ...
Page 93
Figure 5-36: Code Generation tab in Pin Configuration wizard 9. In the New Window screen.QTOUCH_STUDIO_MASKS needs to be enabled in the project option or in touch_qt_config.h file .And in the main.c file, this code SNS_array and SNSK_array needs to be ...
Page 94
QTOUCH_STUDIO_MASKS needs to be enabled if using pin configurability .If not enabled then, static pin mapping will work same as in the earlier versions of the libraries 5.8.2 Pin Configuration for QMatrix Acquisition Method The QMatrix acquisition method libraries ...
Page 95
How to use QTouch Studio for Pin Configurability: The following steps describe the details on how to use pin configurability for QMatix Acquisition method: 1. Open AVR Qtouch Studio .Enable the Design Mode Radio button on the left hand ...
Page 96
Figure 5-38: Selecting New Design 3. In the Create New Design Window, give the Project name and Kit Technology (QMatrix in this case) and Number of sensors (Keys/Rotors/Sliders) and click Create Design. Figure 5-39 Creating New Design in the AVR ...
Page 97
After Creating Design , the new design mode shows the virtual kit view with sensors that have been created in some order. Figure 5-40: New Design Sensors in the AVR QTouch Studio 4. Now Go to Tools->Pin Configuration Wizard as ...
Page 98
Figure 5-42: Start window of the configuration wizard 6. .Select the MCU and click Next as shown below. Figure 5-43: MCU selection window from the configuration wizard. 7. Select the Channels needed for the design from the list provided and ...
Page 99
If 6 channels are needed, the next immediate value that suits the design needs to be selected. Ie., 8 channels ( configuration. Figure 5-44: Selecting channels and configuration in the New Design 8. Select the pins used ...
Page 100
Figure 5-45: Selecting the X,YA,YB,SMP Pins in the new Design with errors. Figure 5-46: Selecting the X,YA,YB,SMP Pins in the new Design without errors. Once the pins are selected, Pin Wizard will provide the summary report .Check whether details are ...
Page 101
If there are some errors that are found in the summary report, the user can click “back” button and modify the changes needed. Figure 5-47: Summary report Figure 5-48: Code Generation tab in Pin Configuration wizard 9. The code is ...
Page 102
The code can be copied using the “copy code” and pasted in the main.c and touch_qm_config file touch_qm_config.h, Copy the following header definitions as part of the preprocessor directives in the project space or in the beginning of ...
Page 103
Target Environment Development Environment IAR Embedded Workbench MISRA Checking software The MISRA C Compliance has been performed for the library using MISRA C 2004 Rules in IAR Workbench development environment. MISRA Rule set applied MISRAC 2004 Rule Set 5.9.3 ...
Page 104
Applicable QTouch libraries ver 4.3.1 release Rule No Rule Description 1.1 Rule states that all code shall conform to ISO 9899 standard C, with no extensions permitted. 10.1 Rule states that Illegal implicit conversion from Underlying long to unsigned long ...
Page 105
The GCC example projects for QMatrix does not compile the delay (QT_DELAY_CYCLES) above a value of 5 because of the preprocessor expansions. Compiling QT600 project files throws unused variable warning. When using IAR workbench for ATSAM to integrate the touch ...
Page 106
... ATtiny20 and ATtiny40 device. 6.3 QTouch Library for AT32UC3L devices ATMEL QTouch Library for UC3L can be used for embedding capacitive touch buttons, sliders and wheels functionality into UC3L application. The QTouch Library for UC3L uses the Capacitive Touch Module (CAT) that senses touch on external capacitive touch sensors. ...
Page 107
... Compiler tool chain support for UC3L The QTouch libraries for AT32UC3L devices are supported for the following compiler tool chains. Tool IAR Embedded Workbench for Atmel AVR32. IAR32 Compiler. AVR32 Studio. AVR GCC GNU Tool Chain. Table 8 Compiler tool chains support for UC3L QTouch Library Version 3 ...
Page 108
Overview of QTouch Library API for UC3L The diagram below captures the high level arrangement of the QTouch Library for UC3L API. The QTouch Library for UC3L API can be used for Sensor configuration, Sensor Acquisition parameter setting and ...
Page 109
Acquisition method support for UC3L With the QTouch Library for UC3L possible for a user to configure the following types of Sensors. • QMatrix method sensors. • QTouch Group A method sensors. • QTouch Group B method ...
Page 110
For the case of Autonomous QTouch, only the TOUCH_STATE_NULL and TOUCH_STATE_INIT states apply in the State diagram. • The touch_at_sensor_init event causes a transition from TOUCH_STATE_NULL to TOUCH_STATE_INIT. • The touch_deinit event causes a transition from TOUCH_STATE_INIT to TOUCH_STATE_NULL. xx ...
Page 111
X and Yk pins wherein Resistive Drive can be enabled, saving on external components is possible. Section 6.3.1.1 provides detail on the number of Pin and Touch channels required for different QMatrix method sensor. The hardware arrangement for Wheel or ...
Page 112
External Discharge mode When the External Discharge arrangement is used, a logic-level (DIS) pin is connected to an external resistor (Rdis) that can be used to control the discharge of the Capacitors. A typical value for Rdis is 100 ...
Page 113
Figure 37 QMatrix method schematic 113 ...
Page 114
QMatrix method hardware resource requirement for UC3L The clock for the CAT module, CLK_CAT, is generated by the Power Manager (PM). This clock is turned on by default, and can be enabled and disabled in the PM. The user ...
Page 115
Using the init_clock() in main.c and clock.c files, Set the CAT_CLK Clock to appropriate value. Set the GCLK_CAT Clock to appropriate value. Using the touch_config_at32uc3l.h configuration file, Set DEF_TOUCH_QMATRIX = 1. Set all QM_xx and TOUCH_xx macros to appropriate values. ...
Page 116
The burst length values of each Touch channel must be specified using the qm_burst_length[] array in the main.c file. The burst length must be specified in the same order of Touch Channel numbering. The touch_qm_sensors_init API initializes the QTouch Library ...
Page 117
QMatrix method Disable and Re-enable Sensor for UC3L The touch_qm_channel_update_burstlen API can be used for Disabling and Re-enabling of QMatrix Sensors. In order to Disable a sensor, the QMatrix burst length value of all the Touch Channels corresponding to ...
Page 118
CAT Module Pin Name CSA0 CSB0 CSA1 CSB1 CSA2 CSB2 CSA3 CSB3 CSA4 CSB4 CSA5 CSB5 CSA6 CSB6 CSA7 CSB7 CSA8 CSB8 CSA9 CSB9 CSA10 CSB10 CSA11 CSB11 CSA12 CSB12 CSA13 CSB13 CSA14 CSB14 CSA15 CSB15 CSA16 CSB16 Table 11 ...
Page 119
... CLK_CAT is enabled before initializing the QTouch Library. The QTouch method acquisition using the CAT module requires one Peripheral DMA channel that must be provided by the application. B. QTouch Group A/B and Autonomous QTouch arrangement. Resistive drive disabled on SNSK Line. Atmel AT32UC3L Sensor SNSK CAT ...
Page 120
QTouch Group A/B method Channel and Sensor numbering for UC3L Figure 41 QTouch method Channel/Sensor numbering The above Figure represents an example 4 Channel QTouch sensor arrangement along with the channel numbers. The Channel numbering starts with the lowest ...
Page 121
QTouch Group A/B method API Flow for UC3L For the QTouch operation, the CAT_CLK must be setup appropriately as a first step. Depending on QTouch Group that need to be used, the QTouch Group A, QTouch Group B and ...
Page 122
Using the init_clock() in main.c and clock.c files, Set the CAT_CLK Clock to appropriate value. Using the touch_config_at32uc3l.h configuration file, Set DEF_TOUCH_QTOUCH_GRP_A = 1, if QTouch Group used. Set DEF_TOUCH_QTOUCH_GRP_B = 1, if QTouch Group B ...
Page 123
QTouch Group A/B method Disable and Re-enable Sensor for UC3L The touch_qt_sensor_disable and touch_qt_sensor_reenable API can be used for Disabling and Re-enabling of QTouch Group A and Group B Sensors. In order to Disable or re-enable a sensor, the ...
Page 124
Autonomous QTouch Sensor API Flow for UC3L For the Autonomous QTouch operation, the CAT_CLK must be setup appropriately as a first step. The Autonomous QTouch and Common configuration parameters in the touch_config_at32uc3l.h configuration must then be set up. The ...
Page 125
Raw acquisition mode support for UC3L The QTouch Library Raw acquisition mode can be used with QMatrix, QTouch Group A and QTouch Group B methods. When raw data acquisition mode is used, once the raw acquisition data is available ...
Page 126
Library Configuration parameters for UC3L The QTouch Library for UC3L provides a single configuration header file touch_config_at32uc3l.h file for setting the various configuration parameters for each method. The different configuration parameters corresponding to QMatrix, QTouch Group A/B and Autononmous ...
Page 127
For QMatrix method Design guidelines regarding Sensor parameters refer Section 6.3.12 Example projects for QTouch Library for UC3L 6.3.12.1 Example Project usage The GNU Example projects can be imported to the AVR32 Studio using ...
Page 128
... Sensor and Global configuration parameters of the QTouch Library at run-time. The QTouch Studio can be downloaded from the following path. http://www.atmel.com/products/touchsoftware/qtouchsuite.asp?family_id=702 The QDebug two-way debug protocol used by the Example project to communicate (transmit or receive touch debug data) with the QTouch Studio can be found in the following installation path. ...
Page 129
For the case of QTouch Group A and Autonomous QTouch Example projects, the ‘QT600-USB Bridge’ board can be use to capture the QDebug debug data in the QTouch Studio. Note 2: In order to flash the ...
Page 130
Library libuc3l-qtouch-iar.r82 libuc3l-qtouch-gnu.a Table 15 Typical Code and Data memory for Standalone QTouch Group A/B operation Note: This Typical Code memory usage is achieved when only the QTouch Group A/B Regular API is used in the application. additional Code memory. ...
Page 131
QMatrix channel. touch_delta_t signed 16 bit integer that represents the delta value of a channel. touch_acq_status_t unsigned 16 bit Status of Touch measurement. touch_qt_grp_t unsigned 8 bit QTouch ...
Page 132
TOUCH_ACQ_INCOMPLETE TOUCH_INVALID_INPUT_PARAM TOUCH_INVALID_LIB_STATE TOUCH_INVALID_QM_CONFIG_PARAM TOUCH_INVALID_AT_CONFIG_PARAM TOUCH_INVALID_QT_CONFIG_PARAM TOUCH_INVALID_GENERAL_CONFIG_PARAM TOUCH_INVALID_QM_NUM_X_LINES TOUCH_INVALID_QM_NUM_Y_LINES TOUCH_INVALID_QM_NUM_SENSORS TOUCH_INVALID_MAXDEV_VALUE TOUCH_INVALID_RECAL_THRESHOLD TOUCH_INVALID_CHANNEL_NUM TOUCH_INVALID_SENSOR_TYPE TOUCH_INVALID_SENSOR_ID TOUCH_INVALID_DMA_PARAM TOUCH_FAILURE_ANALOG_COMP TOUCH_INVALID_RS_NUM 6.3.15.2.2 touch_lib_state_t touch_lib_state_t Enumeration Use Indicates the current state of the library with respect to a specific acquisition method Values TOUCH_LIB_STATE_NULL TOUCH_LIB_STATE_INIT ...
Page 133
Values Comment RAW_ACQ_MODE When Raw acquisition mode is used, the measure_complete_callback function is called immediately once fresh values of Signals are available. In this mode, the Touch Library does not do any processing on the Signals. position values are not ...
Page 134
HYST_12_5 = 2 (12.5 percent of 20) HYST_6_25 = 2 (6.25 percent but set to the hard limit of 2) Values HYST_50 HYST_25 HYST_12_5 HYST_6_25 6.3.15.2.7 recal_threshold_t Enumeration recal_threshold_t Use A sensor recalibration threshold. This is ...
Page 135
RES_8_BIT 8 bit resolution : reported positions range 0 – 255 6.3.15.2.9 at_status_change_t Enumeration at_status_change_t Use Indicates the current status of autonomous QTouch sensor Values Comment OUT_OF_TOUCH Currently the autonomous QTouch channel is out of touch IN_TOUCH Currently the autonomous ...
Page 136
USE_PIN_PA22_AS_SMP Use Pin PA22 as SMP for QMatrix USE_PIN_PA17_AS_DIS Use Pin PA17 as Discharge current control for QMatrix USE_PIN_PB11_AS_VDIV Use Pin PB11 as Voltage divider enable (VDIVEN) for QMatrix USE_PIN_PA15_AS_SYNC Use Pin PA15 as external synchronization input signal (SYNC) USE_PIN_PA18_AS_SYNC ...
Page 137
Input / Output Output from the Library Use Touch Filter Callback data type. Fields Type num_channel_signals uint8_t p_channel_signals uint16_t* 6.3.16.4 touch_measure_data_t structure touch_measure_data_t Input / Output Output from the Library This structure provides updated measure data ...
Page 138
Input / Output Passed as input to touch_at_sensor_update_config API & got as output from touch_at_sensor_get_config API Use Data structure which holds the configuration parameters for the autonomous QTouch sensor Structure field Type filter uint8 t outsens ...
Page 139
Fields Type aks_group aks_group_t detect_threshold threshold_t detect_hysteresis hysteresis_t position_resolution resolution_t 6.3.16.8 touch_at_status structure touch_at_status Input / Output Output structure received as part of the Autonomous QTouch Interrupt callback function. Data structure which holds the status parameters for the autonomous QTouch ...
Page 140
X - Line y_yk_lin uint8_t Bitmask that indicates the selected Y pins for QMatrix. If bit n is set, Yn & es Ykn is enabled for QMatrix; n can Bit Y Y7 & Line YK7 ...
Page 141
6.3.16.13 touch_qm_reg_t structure touch_qm_reg_t Input / Output Input to the library Use Data structure which holds the Register configuration information for QMatrix This structure contains the data fields that correspond to specific fields ...
Page 142
This structure contains the data fields that correspond to specific fields in different registers. For a more detailed explanation of the register fields, refer to the device datasheet. For example, DISHIFT field of ATCFG1 is 2 bits wide (bit 28-29 ...
Page 143
Pointer to a function 6.3.16.17 touch_at_config_t structure touch_at_config_t Input / Output Input to the library Use Data structure which holds the configuration ...
Page 144
Fields Type num_channels uint8_t num_sensors uint8_t num_rotors_and_sliders uint8_t pin touch_qt_pin_t reg touch_qt_reg_t global_param touch_global_param_t p_data_blk uint8_t* buffer_size uint16_t filter_callback Pointer to a function 6.3.16.19 touch_general_config_t structure touch_general_config_t Input / Output Input to the library Data structure which holds the configuration ...
Page 145
Input / Output Input to the library Use Pointer to this structure is passed as input to touch_qm_sensors_init & touch_at_sensor_init APIs Fields Type p_qm_config touch_qm_config_t* p_at_config touch_at_config_t* p_qta_config touch_qt_config_t* p_qtb_config touch_qt_config_t* p_general_config touch_general_config_t* 6.3.16.21 touch_info_t structure touch_info_t Input / Output ...
Page 146
Based on the input parameters, the CAT module is initialized with QMatrix method Pin and Register configuration. • The Analog comparators necessary for QMatrix operation are initialized by this API. • Both p_qm_config & p_general_config members of the input ...
Page 147
Arguments Type sensor_id sensor_id_t p_touch_sensor_param touch_qm_param_t* • This API updates the configuration of a QMatrix sensor with values different from the ones initialized by the touch_qm_sensor_config API. If the sensor was not configured already, the API will return error. • ...
Page 148
Note: When disabling a sensor care must be taken such that all channels of the Sensor are set any of the channels are missed out, it will result in undesired behavior of the Sensor. Similarly when re-enabling ...
Page 149
Arguments current_time_ms p_touch_dma qm_acq_mode void (*measure_complete_callback)( void ) • This API initiates a capacitive measurement on all enabled QMatrix sensors. • When normal acquisition mode is used, once the Touch measurement is completed on all ...
Page 150
The QMatrix number of channels, sensors and rotors/slider indicate the total number of channels, sensors and rotor/slider in use irrespective of Touch measured being disabled or enabled. (Disabling and Re-enabling of a Sensor using the touch_qm_sensor_upate_burstlen API does not ...
Page 151
Arguments Type touch_qt_grp touch_qt_grp_t sensor_type sensor_type_t from_channel channel_t to_channel channel_t aks_group aks_group_t detect_threshold threshold_t detect_hysteresis hysteresis_t position_resolution resolution_t p_sensor_id sensor_id_t* • This API configures a single QTouch Key, Rotor or Slider. • The user must ...
Page 152
This API updates the configuration of a QTouch sensor with values different from the ones initialized by the touch_qt_sensor_config API. If the sensor was not configured already, the API will return error. • The user must populate the structure ...
Page 153
This API can be called to retrieve the QTouch Group A or Group B global parameters. 6.3.17.2.7 touch_qt_sensors_calibrate touch_ret_t touch_qt_sensors_calibrate(touch_qt_grp_t touch_qt_grp ) Arguments touch_qt_grp • This API can be used to calibrate all configured Sensors. • Calibration of all ...
Page 154
Once the filter_callback is completed, the signal values will be processed by the Touch Library. The measure_complete_callback function is then called with touch data (channel_signals, channel_references, sensor_states, sensors structure) as well as the Touch Status (sensor_states) and Rotor/Slider position ...
Page 155
Note: Care must be taken such that a valid Sensor ID corresponding to a QTouch Group A sensor or QTouch Group B Sensor is provided. 6.3.17.2.11 touch_qt_get_libinfo touch_ret_t touch_qt_get_libinfo(touch_qt_grp_t touch_qt_grp, Arguments Type touch_qt_grp touch_qt_grp_t p_ touch_info_t* touch_info • The ...
Page 156
This API initializes the touch library Autonomous touch sensor. This API has to be called before calling any other Autonomous touch API function. • Based on the input parameters, the CAT module is initialized with Autonomous Sensor Pin and ...
Page 157
This API updates the configuration of autonomous QTouch sensor with a setting that is different from the one configured by calling touch_at_sensor_init API. • The user must populate the structure pointed by p_at_param with required settings before calling this ...
Page 158
... IAR Embedded Workbench for Atmel AVR32 MISRA Checking software The MISRA C Compliance has been performed for the library using MISRA C 2004 Rules in IAR Workbench for Atmel AVR32 MISRA Rule set applied MISRAC 2004 Rule Set, All including advisory 6.3.23 Deviations from MISRA C Standards The QTouch library was subjected to the above mentioned MISRA compliance rules ...
Page 159
... In order to avoid this, this warning (Pe047) has been disabled using the Diagnostics option in the IAR32 Project. 6.4 QTouch Library for ATtiny20 device ATMEL QTouch Library for ATtiny20 can be used for embedding capacitive touch buttons functionality into ATtiny20 device application. This Section describes the QTouch Library Application Programming API and Configuration interface for QTouch method acquisition using the ATtiny20 devices ...
Page 160
... Compiler tool chain support for ATtiny20 The QTouch libraries for ATtiny20 devices are supported for the following compiler tool chains. Tool IAR Embedded Workbench for Atmel AVR. IAR Compiler. 6.4.2.1.1 Table 17 Compiler tool chains support for ATtiny20 QTouch Library 6.4.3 ...
Page 161
Figure 48 Schematic overview of QTouch on Tiny20 6.4.4 API Flow diagram for ATtiny20 For the QTouch Libraries, the timing information is provided by the Host Application by updating the ‘time_current_ms’ variable in the Timer ISR. calculate the necessary timing ...
Page 162
Setup the desired device clock using the init_system() in main.c Using the init_timer(), setup the Timer ISR such that the Timer Interrupt occurs every 20ms . Enable the ADC and configure in Free running mode. Using the touch_config_tiny20.h configuration file, ...
Page 163
Parameter DEF_QT_QDEBUG_ENABLE DEF_QT_NUM_SENSORS DEF_QT_SENSOR_0_THRESHOLD, DEF_QT_SENSOR_1_THRESHOLD, DEF_QT_SENSOR_2_THRESHOLD, DEF_QT_SENSOR_3_THRESHOLD, DEF_QT_SENSOR_4_THRESHOLD DEF_QT_SENSOR_0_HYSTERESIS, DEF_QT_SENSOR_1_HYSTERESIS, DEF_QT_SENSOR_2_HYSTERESIS, DEF_QT_SENSOR_3_HYSTERESIS, DEF_QT_SENSOR_4_HYSTERESIS DEF_QT_SENSOR_0_RECAL_THRESHOLD, DEF_QT_SENSOR_1_RECAL_THRESHOLD, DEF_QT_SENSOR_2_RECAL_THRESHOLD, DEF_QT_SENSOR_3_RECAL_THRESHOLD, DEF_QT_SENSOR_4_RECAL_THRESHOLD DEF_QT_DELAY_CYCLES DEF_QT_ADC_CHANNEL_START_INDEX DEF_QT_AKS_ENABLE DEF_QT_DI DEF_QT_NEG_DRIFT_RATE*(See Note 1) DEF_QT_POS_DRIFT_RATE*(See Note 1) DEF_QT_MAX_ON_DURATION DEF_QT_DRIFT_HOLD_TIME DEF_QT_POS_RECAL_DELAY DEF_QT_NUM_SENSORS_SYM DEF_QT_BURST_LENGTH Table 18 QTouch Library for ATtiny20 Configuration ...
Page 164
Note1: For the case of ATtiny20 devices, a ‘touch’ causes the Signal value measured on the Sensor to increase above the Sensor Reference value (In the case of Generic Library devices, a ‘touch’ causes the Signal value to decrease below ...
Page 165
... Sensor, allocated in main.c 3. sensor_recal_threshold, 1 byte per Sensor, allocated in main.c 6.5 QTouch Library for ATtiny40 device ATMEL QTouch Library for ATtiny40 can be used for embedding capacitive touch buttons functionality into ATtiny40 device application. This Section describes the QTouch Library Application Programming API and Configuration interface for QTouch method acquisition using the ATtiny40 devices ...
Page 166
... Compiler tool chain support for ATtiny40 The QTouch libraries for ATtiny40 devices are supported for the following compiler tool chains. Tool IAR Embedded Workbench for Atmel AVR. IAR Compiler. Table 20 Compiler tool chains support for ATtiny40 QTouch Library 6.5.3 Overview of QTouch Library for ATtiny40 For an overview of QTouch method based capacitive touch acquisition, refer QTouch Acquistion method ...
Page 167
API Flow diagram for ATtiny40 For the QTouch Libraries, the timing information is provided by the Host Application by updating the ‘time_current_ms’ variable in the Timer ISR. calculate the necessary timing for Max ON Duration, Drift and Recalibration functionality. ...
Page 168
Figure 52 QTouch method for Tiny40 API Flow diagram 168 8207J-AT42-02/11 ...
Page 169
QTouch Library configuration parameters for ATtiny40 The Table below describes the various configuration parameters corresponding to the ATtiny40 QTouch Library. Parameter DEF_QT_DI DEF_QT_NEG_DRIFT_RATE*(See Note 1) DEF_QT_POS_DRIFT_RATE*(See Note 1) DEF_QT_MAX_ON_DURATION DEF_QT_DRIFT_HOLD_TIME DEF_QT_POS_RECAL_DELAY DEF_QT_SIGNAL_RESOLUTION Table 21 QTouch Library for ATtiny40 Configuration ...
Page 170
QTouch Library ATtiny40 code and data memory requirements The code and data memory requirements for QTouch Library for ATtiny40 devices is captured in the Table below. The Table indicates these values for the standalone library and not for the ...
Page 171
Generic QTouch Libraries for 2K Devices 7.1 Introduction This section provides information about the QTouch library Acquisition Support for Tiny devices with 2K Flash memory. These libraries have the same API’s as Generic libraries, except for a few which ...
Page 172
... The touch_api_2kdevice.h header file is located in the library distribution in the following directory. • ..\Atmel_QTouch_Libraries_4.x\Generic_QTouch_Libraries\include The constant/symbol definitions can be placed in any of the following. Defined user’s project options. All the constants/symbols must be defined for both the compiler and assembler preprocessing definitions. ...
Page 173
Channel numbering when routing SNS and SNSK pins to the same port When SNS and SNSK pins are connected to the same port, the even pin numbers will be used as SNS pins and the odd pins will be ...
Page 174
Configuring SNS and SNSK masks in case of Intraport: 1. Enable the Bit0 in SNS_array[0] and Bit1 in SNSK_array[0] mask when enabling Channel0. 2. Enable the Bit2 in SNS_array[0] and Bit3 in SNSK_array[0] mask when enabling Channel1. 3. Enable ...
Page 175
The following files are to be added along with the touch library and user application before compilation: • For ATtiny 2K devices - touch_api_2kdevice.h, touch_qt_config_2kdevice.h and qt_asm_tiny_mega_2kdevice.S 7.6 MISRA Compliance Report This section lists the compliance and deviations for MISRA ...
Page 176
Rule states that In the definition of a function-like 19.10 macro, each instance of a parameter shall be enclosed in parenthesis 19.12 Rule states that there shall be at most one occurrence of the # or ## preprocessor operator ...
Page 177
May 2010 Ver 4.2 July 2010 Section 5.8, Ver 4.3 Section 5.7.2.4 Jan 2011 Chapter 7, Ver 4.3.1 Section 5.6.11.2.1, Section 5.7.11.2.1 • Device support extended for QMatrix for the release has been added in section 5.7.2.4.1 and 5.7.2.3 • ...
Page 178
... 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 ATMEL’S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL’S WEB SITE, ATMEL ...