Home

Atmel QTouch Library User Guide

image

Contents

1. ATMEL QTouch Library User Guide Page 79 Rev 8207G AT42 12 09 AMEL 7 2 4 2 6 QMatrix acquisition method Library Variants for ATmega164P Legend NC Number of channels Nx x NY Number of X x Y channels NRS amer of Rotors amp Sliders NC Y line Compiler Library to be used Code Data Memory pins memory NY Y_LINES ATmega164P TIP Miu ku 9 9 libm164p 8qm 4x 2y k Ors YL LO NIB r90 GCC libm164p 8qm 4x 2y k Ors YL LO NIB a CIT D fe libm164p 8qm 4x 2y k Ors YL HI NIB r90 GCC libmt64p 8qm 4x 2y k Ors YL HI NIB a 8s jo libm164p Bom 4x 2y krs 2rs YL LO NIB r90 GCC libm164p 8qm 4x 2y krs 2rs YL LO NIB a libm164p 8qm 4x 2y krs 2rs YL HI NIB r90 libm164p Bom 4x 2y krs 2rs YL HI NIB a sebo fora pane libm164p 16qm 4x 4y k Ors YL LO NIB r90 GCC libm164p 16qm 4x 4y k Ors YL LO NIB a TII 4 5 6 7 libm164p 16qm 4x 4y k Ors YL HI NIB r90 libm164p 16qm 4x 4y k Ors YL HI NIB a K a O28 LA libm164p 16qm 4x 4y krs 2rs YL LO NIB r90 libm164p 16qm 4x 4y krs 2rs YL LO NIB a Kej no 4567 um libm164p 16qm 4x 4y krs 2rs YL HI NIB r90 libm164p 16qm 4x 4y krs 2rs YL HI NIB a MGM libm164p 16qm 4x 4y krs 4rs YL LO NIB r90 N libm164p 16qm 4x 4y krs 4rs YL LO NIB a N a V TE libm164p_16qm_4x_4y_krs 4rs YL HI NIB r90 libm164p 16qm 4x 4y krs 4rs YL HI NIB a CEP Y e libm164p 16qm 8x 2y k Ors YL LO NIB r90 libm164p 16qm
2. ATMEL QTouch Library User Guide Page 84 Rev 8207G AT42 12 09 r90 mirnu GCC liobm128rfa1_16qm_8x_2y_krs 2rs YL LO NIB 4396 323 a IAR libm128rfa1 16qm 8x 2y krs 2rs YL_HI_NIB r 3508 327 90 GCC libmi128rfa1 16qm 8x 2y Krs 2rs YL HI NIB a 4396 323 IAR llbm128rfa1_16qm_8x_2y krs 4rs YL LO NIB 3508 347 r90 GCC libm128rfa1 16qm 8x 2y krs drs YL LO NIB 4396 343 a IAR libm128rfa1 16qm 8x 2y krs 4rs YL_HI_NIB r 3508 347 90 GCC libm128rfa1 16qm 8x 2y krs drs YL HI NIB a 4396 343 0 1 2 3 IAR libm128rfa1_32qm_8x 4y k Ors YL LO NIB r9 2186 452 0 GCC libm128r a1 32qm 8x 4y k Ors YL LO NIB a 2820 450 4 5 6 7 IAR libm128rfa1 32qm 8x 4y K Ors YL HI NIB r9 2186 452 0 GCC libm128r ai 32qm 8x 4y k Ors YL HI NlB a 2820 450 0 1 2 3 IAR llbm128rfa1_32qm_8x_4y_ krs 4rs YL LO NIB 3528 573 r90 GCC libm128rfa1_32qm_8x_4y_krs_4rs_YL_ LO NIB 4440 571 a IAR libm128rfal 32qm 8x 4y Krs 4rs YL HI NIB r 3528 573 90 libm128rfa1 32qm 8x 4y krs 4rs YL HI NIB a 4440 571 libm128rfa1 64qm 8x By k Ors YL LO NIB r9 2218 842 0 libm128rfa1 64qm 8x 8y K Ors YL LO NIB a 2830 840 a 7 2 4 2 11 QMatrix acquisition method Library Variants for ATxmega64A3 Legend NC Number of channels Nx x NY Number of X x Y channels ET Number of Rotors amp Sliders Y line Compiler Library to be used Code Data pins memory Memory Y LINES ATxmega64A3 IAR v xm GCC
3. Attiny43u A B A B C D A B C D Attiny45 T IAR GCC Attiny461 A B IAR GCC Attiny84 A B IAR GCC GCC Attiny861 A B IAR GCC IAR GCC IAR GCC IAR GCC IAR GCC GCC IAR GCC libavr4g1 lt CH gt qt k Ors a libavr4g1 lt CH gt qt k lt RS gt rs a use Atmega8 when compiling use Atmega8 when compiling IAR GCC IAR GCC libavr4g2 lt CH gt qt k Ors a libavr4g2 lt CH gt qt k lt RS gt rs a use Atmega88P when use Atmega88P when compiling compiling Attiny85 Attiny48 Attiny88 Attiny167 2 UJ Atmega8515 Atmega8535 o o UJ rm W Oy gt gt JJ JJ Atmega8A U e U B C UO Atmega48PA Atmega88PA B C Atmega8HVA A B O ER GCC IAR GCC GCC ATPWM2 UO m UJ O O O ATPWM2B U JJ m UJ ATMEL QTouch Library User Guide Page 60 Rev 8207G AT42 12 09 MEL G B C D E B C D E Atmega64A A B C G Atmega162 A B C libv3g2 CH at k Ors r90 libv3g2 CH qt k RS rs r90 D libavr5g2 lt CH gt qt k Ors a libavr5g2 lt CH gt qt k lt RS gt rs a B C libv3g2 CH at k Ors r90 libv3g2 CH at k RS rs r90 B E J B E J B E TO J O B E TO J Atmega32A A B C libv3g2 CH at k Ors r90 libv3g2 CH at k RS rs r90 libavr5g2 lt CH gt at k Ors a libavr5g2 lt CH gt qt k lt RS gt rs a use Atmega32 when c
4. Figure 19 Specifying QMatrix acquisition library parameters in IAR IDE project ATMEL QTouch Library User Guide Page 52 Rev 8207G AT42 12 09 Custom Compilation Options l files Aal Al Remove main c gdwarl z 3i Includ Linker Options std gnu33 AI D DEBUG INTERFACE D QMATRIS DOT NUM CHANNELS 232 DPOAT zB DPORT YA B DPORT YB B Libraries DPORT_SMP B DSMP BIT 7 a I DOT MAX NUM ROTORS SLII g f I DDEL amp Y CYCLES 4 D ROTOR SLIDER Memory Settings Us External Tools Custom Options Use Wind A avr gec D winA amp VR 20090313 binsavr gec exe make D wWinAVR 20080313 utileSbinhmake exe Figure 20 Specifying QMatrix acquisition library parameters in AVR Studio IDE project 6 10 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 IAR workbench and AVR Studio IDEs The sample applications are provided for the evaluation kits and a few configurations for select devices The user can use the sample applications as a reference or baseline to configure different configurations Please ensure to change the configuration settings in the project options to match the device selected To change the configuration settings of the sample applications 1 Select the configuration from the list of configurations available 2 Ift
5. 32 bit 8 16 32 QMatrix Acquisition 8 16 32 64 ATMEL QTouch Library User Guide Page 14 Rev 8207G AT42 12 09 AMEL 6 2 2 4 hysteresis t Enumeration X Hysteresis t Use Defines the sensor detection hysteresis value This is expressed as a percentage of the sensor detection threshold This is configurable per sensor HYST_x hysteresis value is x percent of detection threshold value rounded down Note that a minimum value of 2 is used as a hard limit Example if detection threshold 20 then HYST 50 10 50 percent of 20 HYST_25 5 25 percent of 20 HYST 12 5 2 12 5 percent of 20 HYST 6 25 2 6 25 percent of 20 1 but set to the hard limit of 2 HYST_50 50 Hysteresis HYST 25 25 Hysteresis HYST 12 5 12 5 Hysteresis HYST 6 25 6 25 Hysteresis 6 2 2 5 resolution t Enumeration X resolution t Use For rotors and sliders the resolution of the reported angle or position RES x BIT rotor slider reports x bit values Example if slider resolution is RES 7 BIT then reported positions are in the range 0 127 RES 1 BIT 1 bit resolution reported positions range 0 1 RES 2 BIT 2 bit resolution reported positions range 0 3 RES 3 BIT 3 bit resolution reported positions range 0 7 RES 4 BIT 4 bit resolution reported positions range 0 15 RES 6 BIT 6 bit resolution reported positions range 0 63 RES 7 BIT 7 bit resolution reported positions range 0 1
6. F G JO 9 F 0 G JO G JO ATMEL QTouch Library User Guide Page 94 Rev 8207G AT42 12 09 AIMEL 7 2 4 3 8 Device configuration supported for ATmega324P ATmega324PA Device ATmega324P Atmega324PA NOTE AREF is PB2 and needs to be connected to GND Number of Xx Y Y LINES PORT X PORT YA PORT YB PORT SMP BIT Channels configuration SMP supported by the library variant 8cham 4x29 YLIONE C B JA JA 7 8cham 4x29 YLIONE D B JA X JA 7 8chamd 4x2 YLIONE D C X A JA 7 8channel_ 4x2 YLIONE C D A JX A KI I 8 channel 4x2 YLHNB C B A A 8cham 4x2 YLHNB D B JA JA Jo X 8cham 4x2 YLHNB D C X JA 4 V 8channel 4x2 YLHNB C DU ur mm NN ee T H a 16chame 4x4 YLLONE D GT AA 16chame 4x4 YLIONE C D A J Ll 16 channel 4x4 YLHNB DU C JA 16chame 4x40 YLLHLNIB C _ DUT A 186 channel 4x40 YLLHLNIB D OT BUT A 16chame 4x4 YLHNB C B X JA VJ Caen o o eo TI PT u 16chame 8x2Z YLLONB C B 16chame 8x2 YLLONB D B 16channel__ 8x2 LO NIE T D 16channel_ 8xZ YLLONB C D ee 16chame 8x2Z YLHINE C B X 16chame 8x2Z YLHINE D B X 16chame 8xZ
7. YLHINE D C X 16chame 8xZz YLH NE C D p ucc E 32 channel YL LO NB D 32 channel YL LO NIB D L 32 channel 8x4 YLHNE DG 32chame 8x4 YLHNE C D _ 32chane 8x4 YLH NE D BU C B 9 m D j OC D JC 32 channel YL_HI_NIB MEENERMEENE ee e 64 channel 8 amp 8 VLLLOLNIB D _ _ C e 64 channel 8x8 YLIONB C DT 64 channel 8x8 A YLLONB C D J p9 oO E NENNEN oO oO ee NENNEN NEM oO O0 y oO s u oO oO Hc zu oO ee 64 channel YLLO NIB C D VJ NENNEN p p B B B B B B NENNEN mu A KR ATMEL GTouch Library User Guide Page 95 Rev 8207G AT42 12 09 AMEL 7 2 4 3 9 Device configuration supported for ATmega128RFA1 Device ATmega128RFA1 NOTE AREF is PE2 and needs to be connected to GND Number of Xx Y Y LINES PORT X PORT YA PORT YB PORT SMP BIT Channels configuration SMP supported by the library variant KA DPI Sciam aoe 8 1r 8 8chamd 4x2 YLIONE D _ JE F _ G J4 8chamd 4x2 YLIONE D B F X GS 8chame 4x2 YLLONEB D JE F 5 ec NM Nm 8 channel 1 4x2 YLHLNIB D JB X 8 channel 1 4x2 YLHLNIB D JE JX 8 channel 4x2 YLHNB D B 8chame 4x2 YLHINB D E EP ee PIJE I PEN 16 channel
8. 16 channel 4x4 YLHLNIB D JC X 16 channel 4x4 YLHNB C D Gedam 6x3 R R M 186 channel 8x2 YLIONB C B X 186 channel 8x2 YLIONB D JB X p 16chame 8x2 YLIONB D JC J 16chame 8x2 YLIONB C D po 16 channel 8x2 YLHINIB C B X JA 16chame 8x2 YLHNB D B X JA 16chame 8x2 YLHNB D C X JA 18 channel 8x2 YLHNB C D X JA D JC L C JD D J C CD Sa 32 channel YL_LO NIB YL HI NIB YL HI NIB 32 channel 32 channel 32 channel a YL LO NIB nn ee MEME 8x4 8x4 ATMEL QTouch Library User Guide Page 89 Rev 8207G AT42 12 09 AMEL 7 2 4 3 4 Device configuration supported for ATmega8535 Device ATmega8535 NOTE AREF is PB2 and needs to be connected to GND Number of Xx Y Y LINES PORT X PORT YA PORT YB PORT SMP BIT Channels configuration SMP supported by the library variant Bxew uu XJONE LC 18 amp 8 A Ja rachael Om mn ra channel 4x2 YLLONB c D Ja Dua aen muri LE channel exe VLHINB O e a a ra channel 4x2 YLHINB D chame axe YE HENIB D e a A ra channel 4x2 yLmNe C D COO O O l UO O 16 channel 4 x 4 YLLONIB D C 16 channel 4 x 4 YLLONB C D BEEN A A A A A A puni IF 16chame 4x4 YLHNB D GU A 16 channel 4x4 3 YLHNB
9. 16chame 4x4 YLIONE C D F X GO 16chame 4x4 YLIONE D C X F X G JO e a NENNEN NENNEN NENNEN NENNEN MEM 16chame 4x4 YLH NE A B F J F JO A 16chame 4x4 YLHINE B 16chame 4x4 YLH NE D B 16chame 4x4 YLHNE C D X 16chame 4x4 YLH NE D C J F J V Ne as EI PI S IE S PITI 16 channel 8xZ YLLLOLNIB_ AUT BUT FOC GO 16chamd 8xZ YLLONB A OT CCU FOC GO 16chame 8xZ YLIONB A C X F J G 16chame 8x2 YLLILONB A C X F G JO 16chamd 8xZ YLIONB A JD J F JG Jo X 16chamd 8xZ YLIONB B Ja JF JG Jo X 16chamd 8xZ YLIONB C Ja F JG Jo X 16chamd 8xZ YLIONB D Ja JF JG Jo X 16chame 8xZ YLIONB B C F J G JO _ 16chamed 8xZ YLLONB B D F G JO 16chame 8x2 YLLIONB B E F G JO 16chamed 8x2 A YLLONB C B F X G JO _ 16chamd 8xZ YLIONB D B JF JG Jo X 16chamd 8xZ YLIONB C D J F JG Jo X 16chame 8xZ YLIONB C FE F JX G JO 16chamed 8xZz YLLONB D C X F X G JO 16chame 8xZ YLIONB D JE F JG JO KI I NN 16 ch
10. Assembler Custom Build Build Actions Linker Debugger AVR ONE CCR ICE200 JTAGICE JTAGICE mkII Dragon Simulator Factory Settings Mullti file Compilation R Language Code Optimizations Output List f lgnore standard include directories TOOLKIT DIRS AINC TOOLKIT DIRSAINCNCLIB Additional include directories one per line Preprocessor D K UNUS Mnclude Preinclude file Third Party Driver Defined symbols one per line rer QTOUCH rr DEBLIG INTERFACE E DT NUM CHANNELS 8 La c L SNSK A iw Figure 16 Specifying the QTouch acquisition method library configuration parameters in AVR Studio IDE 6 10 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 AVR Studio IDEs The sample applications are provided for the evaluation kits and a few configurations for select devices The user can use the sample applications as a reference or baseline to configure different configurations Please ensure to change the configuration settings in the project options to match the device selected ATMEL QTouch Library User Guide Page 48 Rev 8207G AT42 12 09 AIMEL G To change the configuration settings of the sample applications 1 Select the configuration from the list of configurations available 2 If the user wishes to have a new name for th
11. SMP BIT Channels configuration SMP supported by the library variant 4 x2 VLIONB B D C XD 7 _ 4 x2 YLLONB D B JC J B T 4 x2 PYLHLNIB BO DUT OU 4 x2 PYLHLNIB D B JC B rm rn mi T H E Ii 4 x4 YLLONB TB _ D _ C JD OIO OIO OJO Oooo p NN 83 vons B o 8x2 vons D s Coa l A l e 8x2 YLHNB B D 8 x2 YLH NB D B NENNEN UNE oO 16 channel 4x4 YLLO NB D B TCG B J7 a O0 y oO ATMEL QTouch Library User Guide Page 88 Rev 8207G AT42 12 09 AIMEL G 7 2 4 3 2 Device configuration supported for ATtiny167 Device ATtiny167 NOTE AREF is PA6 and needs to be connected to GND Number of X x Y Y LINES PORT X PORT YA PORT YB PORT SMP BIT Channels configuration SMP supported by the library variant 8cham 4x2 YLHNB B B JX JA JX JB PB channel 1639 T 8 e ta o o 8channel 4xX YLHNB B B JA JA 2 8cham 4xX2 YLHNB B B Ja A 3 7 2 4 3 3 Device configuration supported for ATmega16 ATmega16A Device ATmega16 ATmega16A NOTE AREF is PB2 and needs to be connected to GND Number of X x Y Y LINES PORT X PORT YA PORT YB PORT SMP BIT Channels configuration SMP supported by the library variant E Haas e T 8 tt pH oo ae SERRE Ee ee Se Ce 16 channel 4 x 4 YL LO NIB 16 channel 4 x 4 YL LO NIB o e CD C B J D B D JC J J CD D C JA C JD JA nr ee
12. SMP_ Channels configuration BIT supported by the library variant EET 8 16 32 channel 4X2 4x4 8x2 6x4_ YLIO NIB TR YL LO NIB 4 4 F C C C 8 16 32 channel 4x2 4x4 6x2 8x4 YL LO NIB TE YLIONB D YL LO NIB YL LO NIB E eo m 7 2 4 3 11 Device configuration supported for ATxmega lt xxx gt A1 PORT_ E E E F F C A C C A JC C A JC D A D JA D JA EJAY E JACEE EJAY E JA E F UAE F UAE A C C7 C 7 C 7 D 7 D 7 D 7 Ka au C PATI ET E 7 a NN pom C 7 Device AI xmega lt xxx gt A1 xxx ATxmega64A1 ATxmega128A1 NOTE AREF is PA7 and needs to be connected to GND Number of X x Y Y LINES PORT X PORT YA PORT YB PORT SMP SMP Channels configuration BIT supported by the library variant 7 8 16 32 channel 4x2 4x4 6x2 6x4_ YLLONIB D 8 16 32 channel 4x2 4x4 6x2 6x4_ YL LO NIB E 8 16 52 channel 4x2 4x4 6x2 6x4_ YL LO NIB F 8 16 52 channel 4x2 4x4 6x2 6x4_ YL LO NIB H Y E K C E C F C H C LLO NB J C K C E C C C C C C 8716732 channel 4x2 4x4 8x2 6x4_ YLLO NIB C 8 16 32 channel 4x2 4x4 8x2 6x4_ YL LO NIB E 8 16 32 channel agas aa YLLO NIB K D a 8 16 32 channel 4x2 4x4 8x2 6x4_ YLLO NIB D e Ja JE 7 C A OC T C A OC J7 C A OC J J7 C A CT C A OC Jj7 C A OC J J J7 D
13. The following table lists all the devices for which QMatrix acquisition method libraries are provided Support is provided for both IAR and GCC compiler tool chains unless explicitly noted otherwise ATMEL Device Name For which Supported Channels QMatrix Acquisition is supported ATtiny88 8 16 ATtiny167 8 16 ATmega88PA IAR ATmega88P GCC 8 16 32 ATmega8535 8 16 ATmega16A IAR ATmega16 GCC 8 16 32 ATmega164P 8 16 32 ATmega165P 8 16 32 ATmega325P 8 16 32 ATmega645 8 16 32 ATmega324P 8 16 32 64 ATmega324PA 8 16 32 64 ATmega128HRFA1 8 16 32 64 ATxmega64A1 8 16 32 ATxmega128A1 ATxmega64A3 ATxmega128A3 ATxmega192A3 ATMEL QTouch Library User Guide Page 75 Comments Support provided only for IAR compiler Possible Y Lines only on 0 1 NUM Y LINES 2 or 0 1 2 3 NUM Y LINES 4 pins of the port assigned based on number of Y Lines Rev 8207G AT42 12 09 AMEL ATxmega256A3 ATxmega256A3B 7 2 4 2 QMatrix acquisition method Library Variants for the devices The following QMatrix acquisition method library variants are supported along with the code and data memory footprint for the devices listed for QTouch library release 3 2 7 2 4 2 1_QMatrix acquisition method Library Variants for ATtiny88 Legend NC Number of channels Nx x NY Number of X x Y channels NRS Number of Rotors amp Sliders NC NX Y line Compiler Library to be used Code Data X pins memory Memory NY Y LINES e jo 0
14. 1 1 disp unsigned char DDRC DDC5 1 disp unsigned char DDRC DDC6 1 disp unsigned char DDRC Dummy 1 disp 7 js 10 volatile A DDRC ATMEL QTouch Library User Guide AMEL Page 102 Rev 8207G AT42 12 09 AIMEL G If you prefer to suppress the warnings you can configure the linker options in your project to disable them In the IAR IDE open the project options and in the Linker group click on the diagnostics tab In the field labeled Suppress these diagnostics add W6 This directs the IAR linker to ignore the SFR linker warnings Options for node vlig1_gt_example Category Factory Settings General Options CICLE Compiler Assembler Custom Build Output Extra Output H define Diagnostics List Config Proce Build Actions Always generate output Range checks Generate errors Debugger Segment overlap warnings C Generate warnings e Rua No global type checking C Disabled ICE200 JTAGICE JTAGICE mkII Dragan Simulator Third Party Driver Treat these as warnings W arnings E rors Suppress all warnings Suppress these diagnostics WIE Treat these as errors ATMEL QTouch Library User Guide Page 103 Rev 8207G AT42 12 09 AMEL 11 Revision History The table below lists the revision history for chapters in the user guide QTouch Library User guide Revision History Date Version Chapter Change notes May 2009 All 2
15. 4470 1020 libm324p 64qm 8x 8y krs 8rs YL LO NIB r90 3640 1206 libm324p 64qm 8x By krs 8rs YL LO NIB a 4470 1080 7 2 4 2 9 QMatrix acquisition method Library Variants for ATmega324PA Legend NC Number of channels Nx x NY Number of X x Y channels NRS Number of Rotors amp Sliders Y line Compiler Library to be used Code Data Memory pins memory Y LINES ATmega324PA LELOGLUNL NE 1 Els ET libm324pa 8qm 4x 2y k Ors YL HI NIB r90 2170 95 o Bom 4x 2y krs 2rs YL LO NIB r90 3490 Ee s 0 ores wt orp a e VTO NE m0 2 Te aa o 4557 AR Trema emaa ne 7200 2 Te fea 2 ors an Terezia Team aay Rs R YLO NBO 9520 Ee et 2 A587 an fimoza sar kB vine Nm mr ie fea a ors TAR imezaa em 41 4 ks as TENSE 9520 56 00 Fe fee fo for an Treza ism eey kos vone 7220 eje 45 aR eri om a N ur m ser o ores Wi orp Sm OW ONE 720 S sz ea o 4587 TAR Temo ipa L 2280 eera quur far Rescue RO RON UT ER EN A DILJEM A TEE A libm324pa Slom 8x Faire YL LO NIB r90 2320 zu ps 4 5 6 7 ATMEL QTouch Library User Guide Page 83 Rev 8207G AT42 12 09 AIMEL 0 1 2 3 IAR libn324pa 64qm 8x 8y krs 4rs YL LO NIB r90 3640 1156 4 5 6 7 kad 9 0 1 2 3 IAR libm324pa_64qm_8x_8y_krs_8rs_YL_LO_NIB r90 3640 1206 4 5 6 7 7 2 4 2 10 QMatrix acquisition method Library Variants for ATmega128RFA1 Legend NC Number of channels Nx x NY Number of X x Y channels NRS Number of Rot
16. IAR by the library 1 Library supports keys and rotors supported by the library lib sig hword uinti6_t Holds information about the X and Y lines for a QMatrix library variant LEEREN 0 Y lines are lower pins pin 0 to 3 1 Y lines are on higher pins Pin 4 to 7 Delay Cycle Dwell Cycle Time SMP Pin Number 6 4 Public Functions This section lists the public functions available in the QTouch libraries and its usage 6 4 1 qt set parameters This function is used to initialize the threshold parameters of the QTouch and QMatrix acquisition method libraries This function should be called before configuring and using any sensors and channels ATMEL QTouch Library User Guide Page 19 Rev 8207G AT42 12 09 AMEL void qt set parameters void 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 defined in qt touch lib config data t See section 6 3 2 for details NOTE e This function can be called any time to apply the threshold parameters of the library as specified by modifying the global data structure gt config data exported by the library 6 4 2 qt enable key This function is used to configure a channel as a key void qt enable key channel t channel aks group t 1aks group threshold t detect threshold hysteresis t detect hy
17. Rotors and Sliders 0 2 4 8 Maximum number of rotor sliders that the library supports Y_LINES YL_LO NIB Indicates the beginning bit position of the ports on which Y YL HI NIB Lines are supported by the library variant If Y LINES is YL LO NIB e If 2 Y lines are used Y Lines are on pins 0 1 e f4 Y lines are used Y Lines are on pins 0 1 2 3 e f 8 Y lines are used Y Lines are on pins from O to 7 If Y LINES is YL HI NIB If 2 Y lines are used Y Lines are on pins 4 5 If 4 Y lines are used Y Lines are on pins 4 5 6 7 If 8 Y lines are used the libraries are named as YL LO NIB as suffix since all the 8 port pins would be used The table below provides a few examples of the naming convention Example Library name Configuration supported libn164p 8qm 4x 2y krs 2rs YL Hl NIB a Compiler tool chain GCC Device ATMega164P 8 4 8 S 8 Channels 4 X lines 2 Y lines Supports Keys Rotors and Sliders krs ATMEL QTouch Library User Guide Page 74 Rev 8207G AT42 12 09 AIMEL G e 2Rotors and Sliders e YL HI NB Indicates that Yline pins 4 and 5 will be used libt8B8 16Qq0m 8x 2y K Urs YL LO NIB r90 Device ATTiny88 16 Channels 2 Y lines Compiler tool chain IAR Supports only keys k 0 Rotors and Sliders e e e 8X lines o o YL LO NB Indicates that Yline pins 0 and 1 will be used 7 2 4 QMatrix acquisition method library variants 7 2 4 4 Devices supported for QMatrix Acquisition
18. avrxmega4 libv3xm 8qm 4x 2y k Ors YL LO NIB r90 2271 libavrxmega4 Bom 4x 2y k Ors YL LO NIB a 2906 Mie libv3xm 8qm 4x 2y krs 2rs YL LO NIB r90 3610 libavrxmega4 8qm 4x 2y krs 2rs YL LO NIB a 4530 ATMEL QTouch Library User Guide Page 85 Rev 8207G AT42 12 09 AMEL i 0 1 2 3 libv3xm 16qm 4x 4y k Ors YL LO NIB r90 GCC libavrxmega4 16qm 4x 4y k Ors YL LO NIB a we alll 0 1 2 3 libv3xm 16qm 4x 4y krs 2rs YL LO NIB r90 GCC libavrxmega4 16qm 4x 4y krs 2rs YL LO NIB a eim t 0 1 2 3 libv3xm 16qm 4x 4y krs 4rs YL LO NIB r90 GCC libavrxmega4 16qm 4x 4y krs 4rs YL LO NIB a 4534 16 8x2 0 1 libv3xm 16qm 8x 2y k Ors YL LO NIB r90 2311 GCC libavrxmega4 16qm 8x 2y k Ors YL LO NIB a 2902 aio pe pw ibam 6qm 8x 2y krs 2rs YL LO NIB r90 0 1 32 mI 0 1 2 3 libv3xm 32qm 8x 4y k Ors YL LO NIB r90 GCC libavrxmega4 32qm 8x 4y K Ors YL LO NIB a 4 4 Jona libv3xm 32qm 8x 4y krs 4rs YL LO NIB r90 GCC libavrxmega4 32qm 8x 4y krs 4rs YL LO NIB a 4566 7 2 4 2 12 QMatrix acquisition method Library Variants for ATxmega64A1 Legend NC Number of channels Nx x NY Number of X x Y channels NRS Number of Rotors amp Sliders NC NXx Y line Compiler Library to be used Code Data NY pins memory Memory Y LINES ATxmega64A1 IAR vdAxm GCC avrxmega5 Pye ke libv4xm_8qm_4x_2y k Ors YL LO NIB r90 GCC libavrxmega5 8qm 4x 2y k Ors YL LO NIB a o AR libv xm 8qm 4x 2y krs 2rs YL LO NIB r9
19. 0 recalibration disabled Default value 0 recalibration disabled Sensor negative drift rate in units of 200 ms Default value 20 20 x 200 ms 4s per LSB Sensor positive drift rate in units of 200 ms Default value 5 5 x 200 ms 1s per LSB The QTouch library exports a variable of this type so that the user can specify the threshold parameters for the library The API gt set parameters should be called to apply the parameters specified extern qt touch lib config data t qt config data 6 3 3 qt touch lib measure data t structure qt touch lib measure data t Input Output Output from the library Use Data structure which holds the sensor and channel states and values Fields amp Type Comments channel signals uint 6 t The measured signal on each channel uint 6 t The reference signal for each channel qt touch status qt touch status t The state and position of the configured sensors The QTouch library exports a variable of this type which can be accessed to retrieve the touch status of all the sensors extern qt touch lib measure data t qt measure data 6 3 4 qt burst lengths structure qt burst length Input Output Input to the library Use NOTE Applicable only to the QMatrix acquisition method libraries This data structure is used to specify the burst lengths for each of the QMatrix channels Fields Type Comment qt burst length uint8 t The burst length for each of the
20. 10 3 1 Selecting the right configuration The sample application is built to support a maximum channel support configuration available for that particular device for both IAR amp AVR IDEs Internally there are two configurations for each device e ALL KEYS configuration Supports only keys e KEYS ROTORS SLIDERS configuration Supports keys or rotors or sliders concurrently These configurations enable a set of stored options and a specific library to be selected in order to build application using the specific library 7 JAR Embedded Workbench IDE File Edit View Project Tools Window Help sol J7 Dac wor ks pace m1b5n am E h E S SR k Ors lovi mibop qm 32ch Bx du kra Ars lov E lmn RRR am example m165p_qm_32ch_ I El libmtE5p 3ecm Bx 4 k rs L LO NID raU I jlibmiB amp 5p 32qm 8x 4 krs 4rs YL LO NIB r8 5 main c Lm Ca Output Figure 17 Selecting the right configuration in the QMatrix acquisition method example applications in IAR IDE ATMEL QTouch Library User Guide Page 50 Rev 8207G AT42 12 09 mi54 p qm 32ch 8x 4v k Ors Ylow m154p qm 32c General T I Include Directories Output File Name x la Output File Directory Libraries Device atmegal64p la Frequency p Optimization Os Memory Settings A Ed Create Hex File Custom Optior Z Generate Map File Unsigned
21. 1k RY 1k CS 47nF RYB 470k Port pin count n 2 m 2 n number of X lines RYBO RYBm m number of Y lines Port requirements X Fixed I O pin YA Fixed I O pin YB ADC port SMP Fixed I O pin Vref AINO Comparator The port I O pin should be in consecutive order Figure 5 Schematics for a QMatrix acquisition method design ATMEL QTouch Library User Guide Page 12 Rev 8207G AT42 12 09 AMEL 6 QTouch Library API This section describes the QTouch library Application Programming Interface API for touch sensing using QTouch and QMatrix acquisition methods on AVR microcontrollers Using the API Touch sensors and the associated channels can be defined Once touch sensing has been initiated by the user the host application can use the API to make touch measurements and determine the status of the sensors 6 1 touch_api h public header file The touch_api h header file is the public header file which needs to be included in users application and it has the type definitions and function prototypes of the API s listed in sections 6 2 6 3 and 6 4 The touch_api h header file is located in the library distribution in the following directory e Atmel QTouch Libraries 3 2Wnclude 6 2 Type Definitions and enumerations used in the library 6 2 1 Typedefs This section lists the type definitions used in the library Typdef Notes int16 t signed 16 bit int
22. 81 Rev 8207G AT42 12 09 AMEL 4567 libavrbg3 64qm 8x 8y k Ors YL LO NIB a 2825 m 8x8 4 0 1 2 3 libv3g3 64qm 8x 8y krs 4rs YL LO NIB r90 3590 1150 4 5 6 7 GCC libavr5g3 64qm 8x 8y krs 4rs YL LO NIB a 4470 1020 64 8x8 0 1 2 3 libv3g3 64qm 8x Bv krs 8rs YL LO NIB r90 3590 1182 4 5 6 7 GCC libavr5g3 64qm 8x 8y krs 8rs YL LO NIB a 4470 1052 7 2 4 8A 8 QMatrix acquisition method Library Variants for ATmega324P Legend NC Number of channels Nx x NY Number of X x Y channels NRS Number of Rotors amp Sliders li Compiler Library to be used Code Data i memory Memory Y_LINES ATMega324P Oooo ATMega32AR 0 0 KD TNT libm324p 8qm 4x 2y k Ors YL LO NIB r90 GCC libm324p 8qm 4x 2y k Ors YL LO NIB a V eo 145 D libm324p 8qm 4x 2y k Ors YL HI NIB r90 GCC libm324p 8qm 4x 2y k Ors YL HI NIB a KREVET libm324p_8qm_4x_2y_krs_2rs_YL_LO_NIB r90 GCC libm324p 8qm 4x 2y krs 2rs YL LO NIB a e 45 A libm324p 8qm 4x 2y krs 2rs YL HI NIB r90 GCC libm324p 8qm 4x 2y krs 2rs YL HI NIB a N id LEN 0 1 2 3 libm324p 16qm 4x 4y k Ors YL LO NIB r90 GCC libm324p 16qm 4x 4y k Ors YL LO NIB a eee yo 4567 AR libm324p 16qm 4x 4y k Ors YL HI NIB r90 GCC libm324p 16qm 4x 4y k Ors YL HI NIB a bd ad a 0 1 2 3 libm324p 16qm 4x 4y krs 2rs YL LO NIB r90 GCC libm324p 16qm 4x 4y krs 2rs YL LO NIB a HUE 3 libm324p 16qm 4x 4y krs 2rs YL HI NIB r90 GCC GCC ime to 16qm 4x 4y krs 2rs YL
23. AT42 12 09 AMEL 7 2 4 3 7 Device configuration supported for ATmega165P Device Atmega165P NOTE AREF is PE2 and needs to be connected to GND Number of XxY Y_LINES PORT_X PORT_YA PORT_YB PORT_ SMP_BIT Channels configuration SMP supported by the library variant oO 8chamd 4x2Z YLIONBE A JB _ F JX JG 8chamd 4xZ YLLIONBE A C F X G JO 8 channel 4xZ 3 YLLIONE A D F X J G JO 8chamd 4xZ 3 YLLIONE A E X F X J G JO _ 8cham 4x2Z YLIONE B Ja JF JG Jo X 8chame 4x2Z YLIONE D 8 channel 4x2 YLLLO_NIB B 8chamel 4x2 YLIONIB B 8chame 4x2 YLIONIB B 8chame 4x2 YLLLOLNIB D D B C es ee ee 8 channel 4x2Z YLHINE D 8chame 4xZ YLHINI B 8chame 4x2Z YLHINE B 8chame 4x2Z YLHINE B 8chame 4x2Z A J YLHINE D 8chame 4x2Z YLHINE D 8chame 4x2Z A YLHINE D re a NENNEN 16chamel 4x4 YLLLO_NIB B 16channel 4x4 YLIONE D ATMEL QTouch Library User Guide Page 92 Rev 8207G AT42 12 09 AMEL 16chame 4x4 YLLIONE B COUT FOG 16chame 4x4 YLLIONE B D F J G JO 16chamd 4x4 3 YLIONE C B JF GO 16chamd 4x4 YLIONE D JB JF JG Jo X
24. C D A JX JA Deu 16chame 8x2 YLLIONB C B X JA 9 16chame 8x2 YLLIONB D B _ JA A KR 16 channel 8 x 2 YLLO NIB D C 16 channel 8 x 2 YL_LO_NIB eann es et 6 16channel 8x2 YLHINB C 16chame 8x2 YLHINB D 16chame 8x2 YLHINB D 16channel 8x2 3 YLH NB C D o B B D 7 2 4 3 5 Device configuration supported for ATmega88P ATmega88PA Device ATmega88P ATmega88PA NOTE AREF is PD6 and needs to be connected to GND Number of Xx Y Y LINES PORT X PORT YA PORT YB PORT SMP BIT Channels configuration SMP supported by the library variant 4x2 YLLO NIB B J D gJ j C j D 7 J 8cham 2 YLIONB D B C D 7 nm rn HT ee LE EN PENNE 8came e YLHINB 8 bd c D 0 8c 4 YLHINB D B c D 0 LL TIT IT TNT TI 1 ecam 4x4j Ta NR TR bd c bd 7 6 channel 4x4 YLLONIB D 8 c Jo 7 ATMEL QTouch Library User Guide Page 90 Rev 8207G AT42 12 09 AMEL E Ge GO GO E 16chame 8x2 YLIONIB BO D C J D 7 seek de N NENNEN yn 16 channel 8x2 YLHNB B D G Fd OT Cee E Bs MN 32 channel YLLONB B D UT CUCU 7 2 4 3 6 Device configuration supported for ATmega164P Device ATmega164P NOTE AREF is PB2 and needs to be connected to GND Number of Xx Y Y LINES PORT X PO
25. CH gt qt k Ors a libavr51g2 lt CH gt at k lt RS gt rs a m w TO m w we UG U iG U iG U PIOU P m UJ TO m UJ ITI O O m UJ O ATPWM316 AT90USB646 AT90USB647 Atmega128A DER m ri w rmn w T Cln Cln O m w RS m w We T UJ TO U IG D IGO U PIOU IGO U IGO ID im U m U Tm o AT9OCAN128 A libv3g5 lt CH gt at k Ors r90 libv3g5 lt CH gt at k lt RS gt rs r90 D E F libavr51g2 CH at k Ors a libavr51g2 CH qt k RS rs a G AT90USB1287 A B C libv3g5 CH at k Ors r90 libv3g5 lt CH gt at k lt RS gt rs r90 D E F libavr51g2 lt CH gt qt k Ors a libavr51g2 lt CH gt qt k lt RS gt rs a ATMEL QTouch Library User Guide Page 62 Rev 8207G AT42 12 09 MEL AT90USB1286 A B C libv3g5 CH at k Ors r90 libv3g5 lt CH gt at k lt RS gt rs r90 D E F libavr51g2 lt CH gt qt k Ors a libavr51g2 lt CH gt qt k lt RS gt rs a A B J T m A TI N lt TO TI O J TI O TI O J B E ITI UJ A B C HS rs a D HS rs a ATxmega64al A B C HS rs a D E J H K GCC libavrmega5g2 CH gt k Ors a libavrxmega5g2 lt CH gt at k pm mm A B C HS rs a ATxmega256a3b A B C lt RS gt rs a A B C D
26. Chars funsigned char Unsigned Bitfields funsigned bitfields Pack Structure Members fpack struct Short Enums fshort enums Generate List File Figure 18 Selecting the right configuration in the QMatrix acquisition method example applications in AVR Studio IDE 6 10 3 2 Changing the library configuration parameters The configuration parameters required for the library are specified in the project options of the examples They are as listed below Symbol Range of values Comments QMATRIX This macro should be defined to use QMatrix acquisition method API e g define QMATRIX_ QT NUM CHANNELS 8 16 32 64 Specifies the Maximum Number of channels supported by the library variant selected section 7 2 4 e g define QT NUM CHANNELS 8 QT MAX NUM ROTORS SLIDERS 0 2 4 8 Specifies the Maximum Number of Rotors Sliders supported by the library variant selected section 7 2 4 e g Zdefine QT NUM CHANNELS 8 PORT X See device configurations supported in section 7 2 4 3 PORT YA See device configurations supported in section 7 2 4 3 PORT YB See device configurations supported in section 7 2 4 3 PORT SMP See device configurations supported in section 7 2 4 3 ATMEL QTouch Library User Guide Page 51 Drive electrode for touch sensing using QMatrix acquisition Receive electrode for touch sensing using QMatrix acquisition Receive electrode for touch sensing using QMatrix acquisition SMP Port used for
27. Configurations Active Configuration avrdg1 dat K Ors avro 1bqt k Urs avrdg Tot k Ars Use External Maka wil GETE avro dot k Tre m avr ag1_ogt_k_Ur zu avro But k 2ra Include Directories Output File Mame avrAg1_gt_example elf M Output File Directory avrdg1 4qt K Urs almegaBb15 v Unsigned Chars Funsigned char Unsigned Bitfields funsigned bithelds Pack Structure Members fpack struct Short Enums fshort enums Libraries Device g Frequency hz e f Optimization Us B Memory Settings Figure 12 Selecting the right configuration in QTouch acquisition method example applications in AVR 4 IDE 6 10 2 2 Changing the settings to match your device 6 10 2 2 1 Processor settings Once you have selected the appropriate example project and the configuration you need to ensure that the settings in the project are configured to reflect the correct device The settings include e Device type CPU type for the project Options for node viel_qt_example Category ClC Compiler Assembler Custom Build Target Output Library Configuration Library Options Heap Configu_ 4 E Build Actions Processor configuration Linker Debugger cpustinya4 AT tino d AVR ONE cpu tinye4 61 Hinad rcpustinyeb5 AT tne oe cpu tiny8b1 ATtinyg6 ICEZUU cpu tiny8 7 65T bine ITAGICE cpusting88 ATtiny8a8 JTAGICE mkII cpusushbl28b ATSULISBT285 D
28. EF J T UJ J T UJ Atmega324PA B C libv3g3 lt CH gt at k Ors r90 libv3g3 lt CH gt at k lt RS gt rs r90 GCC libavr5g3 lt CH gt at k Ors a libavr5g3 lt CH gt at k lt RS gt rs a use Atmega324P when use Atmega324P when compiling compiling iT libavr5g3 lt CH gt at k Ors a libavr5g3 lt CH gt at k lt RS gt rs a Atmega3250P A libv3g3 CH at k Ors r90 libv3g3 CH at k RS rs r90 D G Atmega328P B C D libv3g3 CH at k Ors r90 libv3g3 CH at k RS rs r90 libavr5g3 lt CH gt qt k Ors a libavr5g3 lt CH gt aqt k lt RS gt rs a libavr5g3 lt CH gt at k Ors a libavr5g3 lt CH gt aqt k lt RS gt rs a Atmega3290P A B C libv3g3 CH at k Ors r90 libv3g3 lt CH gt at k lt RS gt rs r90 D F G Atmega32C1 B C D libv3g3 CH at k Ors r90 libv3g3 CH at k RS rs r90 E libavr5g3 lt CH gt qt k Ors a libavr5g3 lt CH gt qt k lt RS gt rs a Atmega325P A B C libv3g3 CH at k Ors r90 libv3g3 lt CH gt at k lt RS gt rs r90 D E F G libavr5g3 lt CH gt qt k Ors a libavr5g3 lt CH gt at k lt RS gt rs a Atmega329P A B C libv3g3 CH at k Ors r90 libv3g3 lt CH gt at k lt RS gt rs r90 D F G F libavr5g3 lt CH gt at k Ors a libavr5g3 lt CH gt at k lt RS gt rs a Atmega32HVB libv3g3 CH at k Ors r90 libv3g3 CH qt k RS rs r90 ATMEL GTouch Library User Guide Page 61 Rev 8207G AT42 12 09 AMEL GCC libavr5g3 lt CH gt qt k Ors a_ libavr5g3 lt CH gt qt k
29. HI NIB a 0 1 2 3 e pe ue Im 16qm 8x 2y k Ors YL LO NIB r90 GCC libm324p 16qm 8x 2y k Ors YL LO NIB a te ee yo 145 L libm324p 16qm 8x 2y k Ors YL HI NIB r90 GCC libm324p 16qm 8x 2y k Ors YL HI NIB a ad 191 AG libm324p 16qm 8x 2y krs 2rs YL LO NIB r90 GCC libm324p 16qm 8x 2y krs 2rs YL LO NIB a N d V DA libm324p 16qm 8x 2y krs 2rs YL HI NIB r90 GCC libm324p 16qm 8x 2y krs 2rs YL HI NIB a jeeje Jo ANE libm324p 16qm_8x_2y krs 4rs YL LO NIB r90 GCC libm324p 16qm 8x 2y krs 4rs YL LO NIB a KANE libom324p_16gm_8x_2y_krs_4rs_YL_HI_NIB r9O GCC libm324p 16qm 8x 2y krs 4rs YL HI NIB a mI 0 1 2 3 libm324p 32qm 8x 4y k Ors YL LO NIB r90 GCC libm324p 32qm 8x 4y k Ors YL LO NIB a 32 8x4 O 45 67 IAR___ libm324p 32qm 8x 4y k Ors YL HI NIB r90 ATMEL QTouch Library User Guide Page 82 Rev 8207G AT42 12 09 1 1 GCC libm324p_32gm_8x_4y_k_Ors_YL_HI_NIB a 2825 8x4 4 0 1 2 3 libm324p 32qm 8x 4y krs 4rs YL LO NIB r90 3590 libn324p 32qm 8x 4y krs 4rs YL LO NIB a 4470 571 4 5 6 7 libm324p 32qm 8x 4y krs 4rs YL HI NIB r90 3590 libm324p 32qm 8x 4y krs drs YL HI NIB a 4470 571 me 0 1 2 3 4 libm324p 64qm 8x 8y K Ors YL LO NIB r90 2320 5 6 7 libm324p 64qm 8x 8y k Ors YL LO NIB a 2825 856 8x8 4 0 1 2 3 libm324p 64qm_8x_8y_krs_4rs_YL_LO_NIB r90 3640 1156 4 5 6 7 libm324p 64qm 8x 8y krs 4rs YL LO NIB a
30. HYST 6 25 enable a slider on channels 2 to 4 qt enable slider CHANNEL 2 CHANNEL 4 AKS GROUP 1 16u HYST 6 25 RES 8 BIT Ou enable a key on channel 6 qt enable key CHANNEL 6 AKS GROUP 2 10u HYST 6 25 enable a key on channel 7 qt enable key CHANNEL 7 AKS GROUP 2 10u HYST 6 25 enable a rotor on channels 12 to14 qt enable rotor CHANNEL 12 CHANNEL 14 AKS GROUP 1 16u HYST 6 25 RES 8 BIT Ou enable a key on channel 15 qt enable key CHANNEL 15 AKS GROUP 2 10u HYST 6 25 The channel numbers 0 2 3 4 6 7 are allocated to pins 0 2 3 4 6 7 of D C port pair respectively Pins 1 and 5 of ports C and D can be used for user application Similarly the channel numbers 12 13 14 15 are allocated to pins 4 5 6 7 of B A port pair respectively Pins 1 2 3 and 4 of ports B and A are again unused by the QTouch library and can be used for user application 6 10 4 1 Disabling and Enabling of Pull up for AVR devices The Pull up circuit available in AVR devices for each GPIO pin has to be disabled before QTouch acquisition is performed For tinyAVR and megaAVR devices the Pull up circuit for all GPIO port pins are enabled and disabled together When user needs to configure the pins that are not used by QTouch library for his application he may enable the Pull up circuit after QTouch measurements are performed and disable them before the touch acquisition starts once again as shown in the code s
31. JA DT D JA DT D JA DZ DAD D JA DT D 7 ATMEL QTouch Library User Guide Page 97 Rev 8207G AT42 12 09 8 16 32 channel 4x2 4x4 8x2 8x L LO NIB L LO NIB 4 4 L LO NIB 4 4 4 4 Y 8 16 32 channel 4x2 4x4 8x2 8x YL LO NIB Y Y 876732 channel 4x2 4x4 8x2 6x4_ Y LO NIB D YL LO NB 8716732 channel 4x2 4x4 8x2 6x4_ YL LO NIB K YL LO NIB YL LO NB 876732 channel 4x2 4x4 8x2 6x4_ YL LO NIB F YL LO NIB YL LO NIB YL LO NIB 8716732 channel 4x2 4x4 8x2 6x4_ Y LO NIB D YL LO NIB 8716732 channel 4x2 4x4 8x2 6x4_ YL LO NIB H 8 Checklist This section lists troubleshooting tips and common configuration tips Sensors do not go into detect or have unknown results Check the Pins used for QTouch or QMatrix acquisition methods do not overlap with the applications usage of the ports Check the sensor design and minimize Signal values report arbitrary values Stray capacitance stray capacitance interference in your design Multiplexing pins used by QTouch libraries in your design Waveforms of charging discharging of channels do not show up properly in oscilloscopes JTAG ICE connected Try disconnecting the JTAG ICE to the board completely from the kit JTAG Pins are explicitly needs to be disabled in the main c file disable JTAG pins MCUCR 1u lt lt JTD MCUCR 1u lt lt JTD When using the example applications the debug valu
32. The Ports on which the SNS and SNSK Pins for QTouch acquisition will be used in the selected microcontroller iv Whether Rotor and or Slider support required in the application v The charge cycle duration required for the QTouch acquisition method b There are specific variants of the library which is pre built with a specific configuration set supported Section 7 1 4 lists the different variants of the QTouch acquisition method library variants Select the library variant which matches the requirement above from the list of supported library variants specified in section 7 1 4 3 Define the constants and symbol names required a The next step is to define certain constants and symbols required in the host application files where the touch API is going to be used These values are derived from the parameters defined in step 2 a for your application and the selected library variant in step 2 b above b The constant symbol names are as listed in the table below c he 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 ATMEL QTouch Library User Guide Page 36 Rev 8207G AT42 12 09 AIMEL G li Defined user s project options ii Placed in a separate header file and include this prior to touch api h in the application file where you need to use the touch APIs Table 3 Constant and symbol name definitions required to use the QTouch acquisition m
33. Y lines share the same lines with the JTAG JTAG needs to be disabled Please check the data sheet to ensure that there are no conflicts between the X Y lines and JTAG lines used for the device YB line for a particular device cannot be changed and it has to be the configured to be the ADC port of the selected device The AINO pin of the device needs to be connected to the GND In case of XMEGA devices the reference pin for input to analog comparator is Pin7 of PORTA with all the combinations of libraries supported Hence this needs to be connected to GND Proper grounding should be taken care when the controller board and touch sensing board are different 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 See section 7 2 4 2 for details CO l CO BY gt ATMEL QTouch Library User Guide Page 34 Rev 8207G AT42 12 09 AMEL 6 7 Frequency of operation Vs Charge cycle dwell cycle times The library needs different charge dwell cycles based on the operation and design The recommended range of charge dwell cycle times that the user must select based on the operating clock frequency of the Microcontroller is provided in the table below Fine tuning of the cycle times to match the sensor design may be done by monitoring the reference levels and finding the shortest cycle time where the referenc
34. YLIO NB D 16 channel YL LO NB D B EMEN RN 16 channel YLHLINB D B 16 channel YLHLNB D E Boo Dum U BER zu NENNEN HEN 16chame 4x4 YLHINB D 16chame 4x4 YLH NB D L mu NENNEN T RENE 16chamel 8x2Z YLLIONE D 16chamd 8xZ 3 YLIONE D JE F JG J4 16chamd 8xZ 3 YLIONE D B _ JF JG J5 16chamd 8xZ 3 YLIONE D JE F JG J5 X na mr mm ii NENNEN 16chamd 8xZ A YLHNE D B JF JG 4 16chame 8xZ YLHNE D _ E F J G 4 9 16chamel 8x2 YLHINE D 16chamel 8x2 YLHINE D a a zu pF G 4 9 F G J5 9 B E L 32 channel YLIONBE D B e 32 channel YLIONB D J B J SS ee es E B E 32chame 8x4 YLHINIB D 32chame 8x4 YLHINE D E 32chame 8x4 YLH NE D B 32chame 8x4 3 YLHINE D JE X Es S Mo S E o 64 channel 8 amp 8 YLLONB D BU F 64 channel 88 O YLLONB D BU ATMEL QTouch Library User Guide Page 96 Rev 8207G AT42 12 09 AIMEL G 7 2 4 3 10 Device configuration supported for ATxmega lt xxx gt A3 Device ATxmega lt xxx gt A3 xxx ATxmega64AS3 ATxmega128A3 ATxmega192A3 ATxmega256A3 ATxmega256A3B NOTE AREF is PA7 and needs to be connected to GND Number of X x Y Y LINES PORT X ORT YA PORT YB PORT SMP
35. a QTouch acquisition method design ATMEL QTouch Library User Guide Page 10 Rev 8207G AT42 12 09 AIMEL 5 2 2 QMatrix acquisition method QMatrix devices detect touch using a scanned passive matrix of electrode sets A single QMatrix device can drive a large number of keys enabling a very low cost per key to be achieved QMatrix uses a pair of sensing electrodes for each channel One is an emitting electrode into which a charge consisting of logic pulses is driven in burst mode The other is a receive electrode that couples to the emitter via the overlying panel dielectric When a finger touches the panel the field coupling is changed and touch is detected 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 Field coupling ae eS eS Dielectric front panel Drive Receive electrode electrode Collected charge Driva ES Figure 4 QMatrix Acquisition method The drive electrode or drive line used for QMatrix charge transfer is labeled as the X line The receiver electrode or receive line used for OMatrix charge transfer is labeled as the Y line ATMEL QTouch Library User Guide Page 11 Rev 8207G AT42 12 09 AMEL 5 2 2 1 Sensor schematics for a QMatrix acquisition method design Sensors X Y RXO 0 0 RYm cso C8m Typical values RX
36. 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 e o channel 0 channel 1 channel 2 channel 3 channel 4 channel 5 channel 6 channel 7 QTouch QMatrix Channel Acquisition Method channel_signals optional qt filter callback function i channel signals post processing odio channel signals qt touch status sensor states qt touch status rotor slider values Figure 10 Block diagram to represent usage of filter callback function ATMEL QTouch Library User Guide Page 32 Rev 8207G AT42 12 09 AMEL 6 5 3 6 1 Example Averaging the Last Four Signal Values 1 Add a static variable in the main module filter for channel signals static uint16_t filter QT_NUM_CHANNELS 4 2 Add a filter function prototype to the main module example signal filtering function static void filler data mean 4 void 3 When configuring the ATMEL QTouch library set the callback function pointer set callback function qt filter callback filler data mean 4 4 Add the filter function void filter data mean 4 void uint8 t i Shift previously stored channel signal data Store new channel signal data
37. different definition a single macro definition ATMEL QTouch Library User Guide Page 99 Rev 8207G AT42 12 09 AMEL 9 3 2 QMatrix acquisition method libraries The QMatrix acquisition method software was subject to the above mentioned MISRA compliance rules The following exceptions have not been fixed as they are required for the implementation of the library Applicable QTouch libraries ver 3 2 release RuleNo Rule Description Exceptions Reason Rule states that all code This Rule is not supported as the library implementation shall conform to ISO 9899 requires IAR extensions like __interrupt These intrinsic standard C with no extensions functions relates to device hardware functionality and permitted cannot practically be avoided Rule states that Illegal implicit The library uses macros to combine symbol definitions conversion from Underlying to form a unique expanded symbol name and in this the long to unsigned long usage of unsigned qualifiers for numeric constants e g 98u causes name mangling This is the only occurrence of this error in the library This Rule says that a U suffix The library uses macros to combine symbol definitions shall be applied to all constants to form a unique expanded symbol name and in this the of unsigned type usage of unsigned gualifiers for numeric constants e g 98u causes name mangling This is the only occurrence of this error in the library Rule states that
38. e can support only 3 channel rotors 6 4 4 qt enable slider This function is used to configure a set of channels as a rotor void qt enable slider channel t from channel channel t to channel aks group t 1 aks group threshold t detect threshold hysterisis t detect hysterisis resolution t position resolution uinta t position hysteresis Arguments Type Comment e A Slider sensor requires a contiguous numbers of channels e 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 valid when the slider is reported as being in detect e Incase of QMatrix acquisition method library the channels from channel and to channel can be between 3 to 8 channel numbers apart i e can support 3 to 8 channel sliders e Incase of QTouch acquisition method library the channels from channel and to channel can only be 3 channels apart i e can support only 3 channel sliders 6 4 5 qt init sensing This function is used to initialize the touch sensing for all enabled channels All required sensors should be configured before calling this function void qt init sensing void Arguments Type Comment Vod lb ATMEL QTouch Library User Guide Page 21 Rev 8207G AT42 12 09 AMEL NOTE e All senso
39. functionality Hence we select the 16 channel library variant for GCC complier which supports the required number of sensors channels This works out to be 217bavr5i1g2 16qt K 4rs a Step 2 Defining the constants symbols in the project space In the host application file say main c define the following constants and symbols Zdefine G TOUCH Zdefine QT NUM CHANNELS 16 define SNSK1 B Zdefine SNS1 D define SNSK2 A Zdefine SNS2 C ATMEL QTouch Library User Guide Page 38 Rev 8207G AT42 12 09 AMEL define QT DELAY CYCLES 1 NOTE 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 file Step3 Usage of library APIs Now you can use the touch API s to create initialize and perform touch sensing Please refer to the sample applications in section 6 10 2 for reference These sample applications illustrate the usage of the APPs and the sequence of operation 6 9 2 2 Checklist of items for integrating QTouch acquisition method libraries The following is a checklist of items which needs to be ensured when integrating QTouch acquisition method libraries The clock prescaler register CLKPR XDIV needs to be configured correctly based on the device selected Some devices have clock frequency selection based on fuses It has to be ensured the fuses are set correctly in such cases It is recom
40. krs 2rs YL HI NIB aa 4320 309 GCC libm8535 t6qm 4x 4y ks 4rs YL LO NIB a 4320 339 GCC libm8535 t6qm 4x 4y ks 4rs YL HI NIB a 4320 339 16 8x2 0 01 IAR libm8535 16qm 8x 2y k Ors_YL LO NIB 90 2160 260 PP t GCC libm8535 16qm 8x 2y k Ors YL LO NIBa 2734 254 16 8x2 0 45 IAR libm8535 16qm 8x 2y k Ors YL HI NIB 90 2160 260 PP t GCC lim8535 16qm 8x 2y k Ors YL_HILNIB a 2734 254 PP t GCC lim8535 16qm 8x 2y krs 2rs YL LO NIB a 4320 329 1 GCC libm8535 16qm 8x 2y krs 2rs YL HI NIB aa 4320 329 GCC libm8535 t6qm 8x 2y krs 4rs YL LO NIB a 4320 1349 GCC libm8535 16qm 8x 2y krs 4rs YL HI NIB aa 4320 349 ATMEL QTouch Library User Guide Page 78 Rev 8207G AT42 12 09 AIMEL 7 2 4 2 5 QMatrix acquisition method Library Variants for ATmega16 ATmega16A Legend NC Number of channels Nx x NY Number of X x Y channels Number of Rotors amp Sliders NX x Y line Compiler Library to be used Code Data NY pins memory Memory Y_LINES ATmega16 ATmega16A Peco libm16a 8qm 4x 2y k Ors YL LO NIB r90 GCC libm16 8qm 4x 2y k Ors YL LO NIB a eT Hom 6a 8qm 4x 2y k Ors YL HI NIB r90 MM HAR 0 TOR _Bam_4x_2y krs 2rs YL LO NIB 190 GCC libm16_8qm_4x 2y krs 2rs YL LO NIB a ML nr libm16a 8qm 4x 2y krs 2rs YL HI NIB r90 GCC libm16 8qm 4x 2y krs 2rs YL HI NIB a n 0 1 2 3 libm16a 16qm 4x 4y k Ors YL LO NIB r90 libm16 1
41. requires the use of more than two ports for SNS and SNSK pins the channel numbers in the second set of SNS SNSK port pair continue from the preceding pair as illustrated in Figure 7 pin O of next port pair is channel 8 and pin 7 of the next port pair is channel 15 e Support for more than one pair of SNS and SNSK ports are not available for UC3 devices e Since the channel numbers are fixed to the pins of the SNS and SNSK ports if the design calls for use of a subset of the pins available in the SNS and SNSK ports the user has to skip the channel numbers of the unused SNS and SNSK pins o For example on a 8 channel configuration using a single pair of SNS and SNSK ports if pin 2 is not used for touch sensing on both SNS and SNSK ports channel number 2 is unavailable and care should be taken while configuring the channels and sensors to avoid using this channel ATMEL QTouch Library User Guide Page 25 Rev 8207G AT42 12 09 AMEL y Bios channel O channel 1 Pin 1 sensorO i channel 2 Port A Pin 2 I channel 3 All SNSK pins PINS a PR terminated Pin 4 sensor1 on this port Pin 5 channel 5 a ud Pine Channel 6 C sensor2 channel 7 SNS PoS Pin 7 SE Port Pair one MEME EA channel O Pin 1 channel 1 EB PORE Pin 2 Channel 2 _ _ Sar channel 3 Al
42. time without notice ATMEL does not make any commitment to update the information contained herein Unless specifically provided otherwise ATMEL products are not suitable for and shall not be used in automotive applications ATMEL s products are not intended authorized or warranted for use as components in applications intended to support or sustain life 2009 ATMEL Corporation All rights reserved ATMEL ATMEL logo and combinations thereof AVR AVR Studio megaAVR tinyAVR QTouch and others are registered trademarks QMatrix XMEGA UC3 and others are trademarks of ATMEL Corporation or its subsidiaries Other terms and product names may be trademarks of others Rev 8207G AT42 12 09
43. to a higher frequency for non touch code It is necessary to carefully design timer operation when change frequencies 6 8 Interrupts The library disables interrupts for time critical periods during touch sensing These periods are generally only a few cycles long and so host application interrupts should remain responsive during touch sensing However any interrupt service routines ISRs during touch sensing should be as short as possible to avoid affecting the touch measurements or the application responsiveness As a rule of thumb the combined durations of any ISRs during a capacitive measurement should be less than 1 ms This can be tested during system development by checking the burst duration on the touch channels on an oscilloscope If the total burst duration for any channel varies by more than 1ms while the user is not touching any sensors then ISRs could adversely affect the measurements Please note that none of the API functions should be called from a user interrupt ATMEL QTouch Library User Guide Page 35 Rev 8207G AT42 12 09 AMEL 6 9 Integrating QTouch libraries in your application This section illustrates the key steps required in integrating the QTouch library in your application 6 9 1 Directory structure of the library files The QTouch library directory structure is as listed below Where installation C Program Files Atmel Atmel_QTouch_Libraries_3 2 Header file include touch_api h is located in th
44. which support the required port to be used The channel numbering for QMatrix configuration follows a matrix pattern with the channel numbers starting from 0 for the matrix intersection XOYO and increasing along the X lines for a given Y line Channel 1 is X1YO and then moving on to the row number O for the next column Table 1 lists the possible channel numbers and the associated X Y line associations for the different configurations of QMatrix library variants A group of channels form a sensor and the sensor numbering is determined by the order in which the user defines the association of channels and uses them as a sensor The channel numbering is fixed for a specific library variant based on the number of X and Y lines used whereas the sensor numbering is determined at the time of usage based on the order in which the user defines the association of the channels to create a sensor NOTE e All channels selected for a specific rotor or slider should be on a single Y line ATMEL QTouch Library User Guide Page 28 Rev 8207G AT42 12 09 AMEL Table 1 Channel numbers for QMatrix configurations Line label 8 channel 16 channel 16 channel 32 channel 64 channel Tu configuration Configuration Configuration configuration configuration 4 x2 8 x 2 4 x 4 8 x 4 8 x 8 ATMEL QTouch Library User Guide Page 29 Rev 8207G AT42 12 09 AMEL 6 5 2 Sensor Numbering The ordering and numbering of sensors is rela
45. 0 GCC libavrxmega5 8qm 4x 2y krs 2rs YL LO NIB a 16 4x4 0 1 2 3 IAR libvAxm 16qm 4x 4y K Ors YL LO NIB r90 GCC libavrxmega5 16qm 4x 4y k Ors YL LO NIB a 0 1 2 3 IAR libv xm 16qm 4x 4y krs 2rs YL LO NIB r90 GCC libavrxmegab5 16qm 4x 4y krs 2rs YL LO NIB a mw Im 0 1 2 3 libv xm 16qm 4x 4y krs 4rs YL LO NIB r90 GCC libavrxmega5 16qm 4x 4y krs 4rs YL LO NIB a WENN libv4xm_16qm_8x_2y K Ors YL LO NIB r90 GCC libavrxmegab5 16qm 8x 2y k Ors YL LO NIB a libv4xm 16qm 8x 2y krs 2rs YL LO NIB r90 GCC libavrxmegab5 16qm 8x 2y krs 2rs YL LO NIB a libvAxm 16qm 8x 2y krs 4rs YL LO NIB r90 GCC libavrxmega5 16qm 8x 2y krs 4rs YL LO NIB a 32 8x4 0 1 2 3 IAR Byd xm 32qm 8x 4y K Ors YL LO NIB r90 GCC libavrxmega5 32qm 8x 4y k Ors YL LO NIB a 0 1 2 3 libv4xm 32qm 8x 4y krs 4rs YL LO NIB r90 libavrxmegab 32qm 8x 4y krs 4rs YL LO NIB a ATMEL QTouch Library User Guide Page 86 Rev 8207G AT42 12 09 AIMEL G 7 2 4 2 13 QMatrix acquisition method Library Variants for ATxmega128A3 ATxmega192A3 ATxmega256A3 ATxmega256A3B Legend NC Number of channels Nx x NY Number of X x Y channels ET Number of Rotors amp Sliders NX x Y line Compiler Library to be used Code Data NY pins memory Memory Y LINES eye fo Ni ATxmegat92A3 ATxmega256A3 ATxmega256A3B IAR vbxm GCC avrxmega6 ZP Ro libvbxm 8qm 4x 2y k Ors YL LO NIB r90 GCC libavrxmega6 8qm 4x 2y k Ors YL LO NIB a 09 libvbxm 8qm 4x 2y krs 2rs YL LO NIB r90
46. 0 kits the output measurement values cannot be viewed through AVR QTouch Studio Please refer to section 6 10 7 3 for more information on observing the output touch measurement data without the use of a USB bridge or AVR QTouch Studio 6 10 7 1 Debug Support in the sample applications for EVK2080 and QT600 boards The sample applications provided for the EVK2080 boards and the QT600 boards output debug information which are captured by a USB bridge chip and then routed to the PC software QTouch Studio for display 6 10 7 2 How to turn on the debug option In the project options the symbol definition DEBUG INTERFACE is used to enable reporting the debug data Based on the IDE used you can do the following to enable the debug feature JAR EWAVR In the project options gt C C compiler gt Preprocessor Tab Add the Directive DEBUG INTERFACE _ Options for node v3g1 8qt example Category Factory Settings General Options I Hulti file Compilation E Assembler Custom Build Language Code Optimizations Output List Preprocessor D 2 k Build Actions linke lanore standard include directories TOOLEIT_OCIF SINCS INE FTOOLEIT_DIRSSINCSCLIB Debugger CCR TCE2O0 Additional include directories fone per line JITAGSITCE JTAGICE mkII STE Preinclude file Simulator Third Party Driver Ed Defined symbols one per line Preprocessor output to file DEBUG INTERFACE R T H SLIDER Figur
47. 1 disp 4 unsigned char DDRC Bitb 1 disp 5 unsigned char DDRC Bite 1 disp 6 unsigned char DDRC Bit 1 disp 7 struct Elements 8 Bytes 1 First seen in burst 10 BC unsigned char DDRC_DDCO 1 disp 0 unsigned char DDRC_DDC1 1 disp 1 unsigned char DDRC DDC2 1 disp 2 unsigned char DDRC DDC3 1 disp 3 unsigned char DDRC DDCA 1 disp 4 unsigned char DDRC DDC5 1 disp 5 unsigned char DDRC DDC6 1 disp 6 unsigned char DDRC DDC7 1 disp 7 ATMEL QTouch Library User Guide Page 101 Rev 8207G AT42 12 09 E 10 volatile A DDRC In module main union Elements 3 Bytes First seen in main unsigned char DDRC struct Elements 8 Bytes First seen in main unsigned char DDRC BIO unsigned char DDRC_Bit1 unsigned char DDRC Bit3 unsigned char DDRC _Bit4 unsigned char DDRC Bit unsigned char DDRC Bite unsigned char DDRC Bit Is struct Elements 8 Bytes First seen in main unsigned char DDRC DDCO 1 disp unsigned char DDRC DDC1 unsigned char DDRC DDC2 1 disp unsigned char DDRC DDC3 1 disp unsigned char DDRC DDCA 1 disp E 1 disp 0 1 disp 1 unsigned char DDRC Bit2 1 disp 2 1 disp 3 1 disp 4 1 disp 5 1 disp 6 1 disp 7
48. 27 RES 8 BIT 8 bit resolution reported positions range 0 255 RES 2 BIT RES 3 BIT RES 4 BIT HES 5 BIT 5 bit resolution reported positions range 0 31 RES 6 BIT RES 7 BIT 6 2 2 6 recal threshold t Enumeration recal threshold t Use A sensor recalibration threshold This is expressed as a percentage of the sensor detection threshold This is for automatic recovery from false conditions such as a calibration while sensors were touched or a significant step change in power supply voltage ATMEL QTouch Library User Guide Page 15 Rev 8207G AT42 12 09 AMEL If the false condition persists the library will recalibrate according to the settings of the recalibration threshold This setting is applicable to all the configured sensors Usage RECAL x recalibration threshold is x percent of detection threshold value rounded down Note a minimum value of 4 is used Example if detection threshold 40 then RECAL 100 40 100 percent of 40 RECAL 50 lt 20 50 percent of 40 RECAL_25 10 25 percent of 40 RECAL 12 5 5 12 5 percent of 40 RECAL 6 25 4 6 25 percent of 40 2 but value is limited to 4 RECAL 100 100 recalibration threshold RECAL 50 recalibration threshold 50 RECAL 25 25 recalibration threshold RECAL 12 5 12 5 recalibration threshold RECAL 6 25 6 25 recalibration threshold 6 3 Data structures This section lists the data structure
49. 2y krs 2rs YL HI NIB a 7 2 4 2 8 QMatrix acquisition method Library Variants for ATmnega88P ATmega88PA Legend NC Number of channels Nx x NY Number of X x Y channels NRS Number of Rotors amp Sliders ep Y line Library to be used Code Data pins memory Memory NY Y LINES idi lai ka libm88pa 8gm 4x 2y k Ors YL LO NIB r90 libm88p 8qm 4x 2y k Ors YL LO NIB a Beo D libm88pa Bom 4x 2y K Ors YL HI NIB r90 libm88p 8qm 4x 2y k Ors YL HI NIB a 4x2 2 MEET liom88pa_8gm_4x_2y_krs_2rs_YL_LO_NIB r9O libm88p 8qm 4x 2y krs 2rs YL LO NIB a INL an libm88pa 8qm 4x 2y krs 2rs YL HI NIB r90 libm88p 8qm 4x 2y krs 2rs YL HI NIB a libm88pa 16qm 4x 4y k Ors YL LO NIB r90 libm88p 16qm 4x 4y k Ors YL LO NIB a libm88pa 16qm 4x 4y krs 2rs YL LO NIB r90 libm88p 16qm 4x 4y krs 2rs YL LO NIB a libm88pa 16qm 4x 4y krs 4rs YL LO NIB r90 libm88p 16gqm 4x 4y krs 4rs YL LO NIB a a libm88pa_16qm_8x_2y k Ors YL LO NIB r90 libm88p_16qm_8x_2y k Ors YL LO NIB a i libm88pa 16qm 8x 2y k Ors YL HI NIB r90 GCC libm88p 16qm 8x 2y k Ors YL HI NIB a libm88pa 16qm 8x 2y krs 2rs YL LO NIB r90 GCC GCO limB8p 16qm 8x 2y krs 2rs YL LO NIB a 16 A 6qm 8x 2y krs 2rs YL HI NIB a 4340 libm88pa 16qm 8x 2y krs 4rs YL LO NIB r90 3460 ATMEL QTouch Library User Guide Page 77 Rev 8207G AT42 12 09 libm88p 16gm 8x 2y krs 4rs YL LO NIB a 4340 OST T T 16 NEN libm88pa 16qm 8x 2y krs 4rs YL HI NIB r90 libm88p 16qm 8x 2y krs 4rs YL HI NIB a
50. 3 to 8 channels per rotor slider 3 Once the library variant is selected you need to specify the right configuration to specify when using the library as the library variant can support a few configurations Select the right configuration which matches your needs from the list of supported configurations for each device in section 7 2 4 3 4 Define the constants and symbol names required a he next step is to define certain constants and symbols required in the host application files where the touch APIs are going to be used b he constant symbol names are as listed in the table below c heconstant 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 li Defined user s project options ii Placed in a separate header file and include this prior to touch api h in the application file where you need to use the touch APIs 9o0o0p Table 4 List of configurable parameters for touch library usage Symbol Constant name Range of values _OMATRIX_ Symbol defined to indicate OMatrix Define this symbol to indicate acquisition method is required QMatrix acquisition method is required PORT_X As defined in the port configurations Drive electrode for touch sensing supported for the device selected in using QMatrix acquisition section 7 2 4 3 PORT_YA As defined in the port configurations Drive electrode for touch sensing supported for the device selected in using QM
51. 32 4o ones libm88pa 32qm 8x 4y k Ors YL LO NIB r90 libm88p 32qm 8x 4y k Ors YL LO NIB a 0 1 2 3 libm88pa 32qm 8x 4y krs 4rs YL LO NIB r90 3510 696 573 GCC GCC libm88p 32qm 8x 4y krs 4rs YL LO NIB a 4394 571 7 2 4 8 4 QMatrix acquisition method Library Variants for ATmnega8535 Legend NC Number of channels Nx x NY Number of X x Y channels NRS Number of Rotors amp Sliders NC Y line Compiler Library to be used Code memory Data X pins Memory NY Y LINES ATmega8535 0 Almega8585 Bee e E libm8535 Bom 4x 2y K Ors YL LO NIB r90 GCC libm8535 8qm 4x 2y k Ors YL LO NIB a rs Ts De libm8535 Bom 4x 2y K Ors YL HI NIB r90 GCC GCC libm8535_8qm_4x 2y K Ore Yl H NIB a 8 42 2 01 IAR libm8535 8qm 4x 2y krs 2rs YL LO NIB r90 3390 236 f ccc libm8535 8qm 4x 2y krs 2rs YL LO NiB a 4312 194 8 42 2 45 lIAR libm8535 8qm 4x 2y krs 2rs YL_HI_NIBr90 3390 236 l GCC libm8535 8qm 4x 2y krs 2rs YL HI NIB a 4312 194 16 4x4 O 101 23 IAR libm8535 16qm 4x 4y k Ors YL LO NIB r90 2140 246 1 GCC libm8535 16qm 4x 4y k Ors YL LO NIB aa 2738 240 16 4x4 O 45 67 IAR libm8535 16qm 4x 4y k Ors YL HI NIB r90 2140 246 l 1 GCC libm8535 16qm 4x 4y k Ors YL HI Nia 2738 240 l Ll GCC libm8535 16qm 4x 4y krs 2rs YL LO NIB a 4320 309 l l1 GCC libm8535 16qm 4x 4y
52. 4 Saint Quentin en Yvelines Cedex France Tel 33 1 30 60 70 00 Fax 33 1 30 60 71 11 Tel 81 3 3523 3551 Fax 81 3 3523 7581 Product Contact Web Site http www atmel com Sales Contact www atmel com contacts Technical Support avr Q atmel com Literature Request www atmel com literature 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 ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTY OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE OR NON INFRINGEMENT IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT INDIRECT CONSEQUENTIAL PUNITIVE SPECIAL OR INCIDENTAL DAMAGES INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF PROFITS BUSINESS INTERRUPTION OR LOSS OF INFORMATION ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES ATMEL makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any
53. 6qm 4x 4y k Ors YL LO NIB a URA 4 5 6 7 libm16a 16qm 4x 4y k Ors YL HI NIB r90 libm16 16qm 4x 4y k Ors YL HI NIB a m pP 0 1 2 3 libm16a 16qm 4x 4y krs 2rs YL LO NIB r90 GCC libm16 16qm 4x 4y krs 2rs YL LO NIB a TPI 4567 PAR libm16a 16qm 4x 4y krs 2rs YL HI NIB r90 GCC libm16 16qm 4x 4y krs 2rs YL HI NIB a NURI 0 1 2 3 libm16a 16qm 4x 4y krs 4rs YL LO NIB r90 GCC libm16 16qm 4x 4y krs 4rs YL LO NIB a ema 4 4567 LAB libm16a 16qm 4x 4y krs 4rs YL HI NIB r90 GCC libm16 16qm 4x 4y krs 4rs YL HI NIB a e ee o jo 7 libm16a 16qm 8x 2y k Ors YL LO NIB r90 GCC libm16 16qm 8x 2y k Ors YL LO NIB a Nad 19 45 A libm16a 16qm 8x 2y k Ors YL HI NIB r90 GCC libm16 16qm 8x 2y k Ors YL HI NIB a ai je Iw Hom 6a _16qm_8x_2y krs 2rs YL LO NIB r90 4 5 jee j4 fo PR bes 16qm 8x 2y krs 4rs YL LO NIB r90 GCC libm16 16qm 8x 2y krs 4rs YL LO NIB a Md 4 libm16a 16qm 8x 2y krs 4rs YL HI NIB r90 GCC libm16 16qm 8x 2y krs 4rs YL HI NIB a I 0 1 2 3 libm16a 32qm 8x 4y k Ors YL LO NIB r90 libm16 32qm 8x 4y k Ors YL LO NIB a MEN 4 5 6 7 libm16a 32qm 8x 4y k Ors YL HI NIB r90 libm16 32qm 8x 4y k Ors YL HI NIB a 32 8x4 0 1 2 3 libm16a 32qm 8x 4y krs 4rs YL LO NIB r90 3590 696 GCC libm16 32qm 8x 4y krs 4rs YL LO NIB a 4434 32 8x4 4 5 6 7 libm16a 32qm 8x 4y krs 4rs YL HI NIB r90 3590 696 GCC libm16 32qm 8x 4y krs 4rs YL HI NIB a 4434
54. 7 1 6 2 LAR compiler tool chain memory footprint for QTouch acquisition method libraries sssssse 70 1 4 QMATRIX ACQUISITION METHOD LIBRARY VARIANTS sccccsscccsseccesecceececenecceneceeeceeeceeeneceeeceeeeceeeneeeenscss 73 7 2 1 i700 21710079 ERR IESI EA EEE EENE I AAEE ATE TE EEE i eee 73 4 212 Support for different compiler tool chains sss sse 73 1 25 OMatrix Acquisition method library naming conventions eee ee e e e eee ZI 7 2 4 OMatrix acquisition method library Yaran sese eee 75 7 2 4 1 Devices supported for QMatrix Acquisition eee eee eee eee 75 7 2 4 2 QMaatrix acquisition method Library Variants for the A VICES cccccceccceecececeeeeeeeeeeseeeeceeeeeeeeeeeeeaeeeeeeseeeees 76 7 2 4 2 QMatrix acquisition method Library Variants for ATtiny88 sss sese 76 7 2 4 2 2 QMaatrix M acquisition method Library Variants for ATtiny 167 sees 77 7 2 4 2 3 QMaatrix acquisition method Library Variants for ATmega88P ATmega88PA cccccccceceeeeeeeeeeeeeeeees 77 7 2 4 2 4 QMatrix acquisition method Library Variants for ATmega8535 sese eene nennen 78 7 2 4 2 5 QMaatrix acquisition method Library Variants for ATmegal6 ATmegal 6A eee 79 7 2 4 2 06 QMaatrix acquisition method Library Variants for ATmegal 64P eee 80 7 2 4 2 QMatrix acquisition method Library Variants for v3g3 avr5g3 sese 81 ATmeoa l65P A Bits S PI sr alg s sis sss 81 7 2 4 2 8 QM
55. 8x 2y k Ors YL LO NIB a libm164p 16qm 8x 2y k Ors YL HI NIB r90 libm164p 16qm 8x 2y k Ors YL HI NIB a libm164p 16qm 8x 2y rs 2rs YL LO NIB r90 libm164p 16qm 8x 2y krs 2rs YL LO NIB a libm164p 16qm 8x 2y krs 2rs YL HI NIB r90 libm164p 16qm 8x 2y krs 2rs YL HI NIB a libm164p 16gm 8x 2y krs 4rs YL LO NIB r90 Homi 64p_ 16qm 8x 2y krs 4rs YL LO NIB a B m E mm p a a a HL NIB r90 libm164p 32qm 8x 4y k Ors YL HI NIB a mem libm164p 32qm 8x 4y krs 4rs YL LO NIB r90 3590 696 libm164p 32qm 8x 4y krs 4rs YL LO NIB a d ox fa 4567 libm164p 32qm 8x 4y krs 4rs YL HI NIB 90 3590 696 libm164p 32qm 8x 4y krs 4rs YL HI NIB a ATMEL QTouch Library User Guide Page 80 Rev 8207G AT42 12 09 AIMEL 7 2 4 2 7 QMatrix acquisition method Library Variants for v3g3 avr5g3 ATmega165P ATmega325P ATmega645 Legend NC Number of channels Nx x NY Number of X x Y channels NRS TA of Rotors amp Sliders NC Y line Compiler Library to be used Code Data Memory pins memory NY Y LINES ATMega165P ATmega325P ATmega645 WIEN libv3g3 Bom 4x 2y K Ors YL LO NIB r90 GCC libavrbg3 8qm 4x 2y K Ors YL LO NIB a libv3g3 8qm 4x 2y k Ors YL HI NIB r90 GCC libavrbg3 8qm 4x 2y K Ors YL HI NIB a libv3g3 Bom 4x 2y krs 2rs YL LO NIB r90 libavrbga 8qm 4x 2y krs 2rs YL LO NIB a libv3g3 Bom 4x 2y krs 2rs YL HI NIB r90 libavr5g3 8qm 4x 2y krs 2rs YL HI NIB a libv3g3 16qm 4x 4y k Ors Y
56. 9 AIMEL G qt enable slider CHANNEL 0 CHANNEL 2 NO AKS GROUP 16 HYST 6 25 RES 8 BIT 0 Now the rotor is sensor O the keys are sensors 1 and 2 and the slider is sensor 3 So the order in which the user enables the sensors is the order in which the sensors are numbered Depending on the user requirements the sensors can be configured in the preferred order 6 5 3 Using the Sensors 6 5 3 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 For example if an 8 channel device is configured to support 8 keys then the library will measure the keys on channels 0 2 4 and 6 simultaneously followed by keys on channels 1 3 5 and 7 If the same device is configured say to support 4 keys putting them either on all the odd channels or on all the even channels means that they can all be measured simultaneously This means the library calls are faster and the device can use less power So it is recommended that the appropriate channel numbers are used when using less than the maximum number of channels available for the device to ensure optimum performance 6 5 3 2 Detect Integration The QTouch Libraries feature a detection integration mechanism which acts to confirm detect
57. 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 s periodically or based on application needs to retrieve the channel information and determine touch sensor states channel 0 channel 1 channel 2 channel 3 sensorO Host Atmel QTouch Application Library channel 4 Sensor channel 5 channel 6 C sensor2 channel 7 J C sensor3 Figure 1 Typical interface of the ATMEL QTouch library with the host application Figure 1 shows a typical configuration of channels when using an AVR and using the ATMEL QTouch Library The ATMEL QTouch Library has been added to a host application running on an AVR microcontroller The sample configuration illustrates using the library that supports eight touch channels numbered O to 7 The sensors are configured in the following order Channels 0 to 2 have been configured as a rotor sensor Channels 3 to 5 have been configured as a slider sensor Channel 6 is configured as key sensor Channel 7 is configured as key sensor The host application uses the QTouch library API s to configu
58. Atmel GTouch Library User Guide Supports QTouch and QMatrix acquisition for Keys Sliders and Rotors Rev 8207G AT42 12 09 Table of Contents TABELE OFCONTEN KTT 2 LE PREIS asa reece ce 990892009605 006905 0 8 60 5900000 2 098 00 59 00000 000 0 0 seus vevsee2essgesessvauswecesse0saseeevsnesussesceneseuees 5 2 INTRODUC TION e Ec 6 S OV VY io goo age eona aecc ceca doce polet kre u POZNAJEMO KA d 6 4 ABBREVIATIONS AND DEFINITIONS 4 442402000000 00000 0000 0000 00000000000000000000000000v0 0000 Dau Suae 0000 0000 0000 0000000 7 4 1 DE TOR ye a AE E E 7 3 OTOU CHLILRAR S ranee E EOE 8 5 1 INTRODU Le O 5 2 ACQUISITION METHODS scsinonesauwamidnosiioantaenensnusicasianwendcewoudann Krna EEEN EA TETEE ENEE TEE 9 5 2 1 OTouch acquisition TIT RETE 9 5 2 1 1 Sensor schematics for a QTouch acquisition method design sss sese 10 ay OMan aU eU DIUINITUS RE RICE 11 5 2 2 1 Sensor schematics for a QMatrix acquisition method design sss sese 12 VR BLUE PUE e pu m 13 6 1 TOUCH API H PUBLIC HEADER FILE eee eee 13 6 2 TYPE DEFINITIONS AND ENUMERATIONS USED IN THE LIBRARY see ee eee 13 6 2 1 Jug mE OAA 13 6 2 2 ENUE TOT ONN u i ies is cosas VGA ss sw ac ae estan new Sos ts E tg ad c
59. CG CG CG CG CG CG CG CG_ CG DG DG DG DG DG DG BF _AF EE DE BE AE DD BD AD BB AB AA FF EF CF BF _AF EE DG DG DG DG DG DG DG DG DOE EG EG EG EG EG EG EG EGS EG_ Ports CE _BE AE CC BC AC BB AB AA FF DF CF BF AF DD CD BD AD CC Avail EG able EG _A EG EG EG FG FG FG FG FG FG FG FG EOG FG_ FG FG FG FG FG A B BC C BB AB AA EE DE CE BE AE DD CD BD AD CC BC AC BB AB AA Q D GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG EF geo ss Ae Ge nels I ES EDE CE BE AE DD CD BD AD CC BC AC BB AB AA AD ATMEL QTouch Library User Guide Page 66 Rev 8207G AT42 12 09 DF_EE FF_EE AIMEL G 7 1 5 3 2 Port combinations when using ports D to K on devices The valid SNSK1 SNS1 amp SNSK2 SNS2 port combinations for libraries supporting a subset of the ports A B C D E F amp G are given below NOTE Port pair convention followed in the table below MN OP M Port used for SNSK in pair 1 N Port used for SNS in pair 1 O Port used for SNSK in pair 2 P Port used for SNS in pair 2 EF DD FF DE Ports available JJ DD DH EE EH JJ FH JJ JH EF JH DF 7 1 5 4 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 for the sensor Example Port configuration with pin assignments SNSK1 SNS1 amp SNSK2 SNS2 pins e g SNS1 D SNSK1 B a
60. E GCC libavrxmega6g1 CH qt k Ors a libavrxmega6g1 lt CH gt qt k A B C D E GCC libavrxmega6g1 CH qt k Ors a libavrxmega6g1 lt CH gt qt k ATxmegal92d3 A B C HS rs a ATxmegal2823 A B C HS rs a A B C D E F GCC libavrxmega6g1 lt CH gt at k Ors a_ libavrxmega6g1 lt CH gt at k ATxmega64a3 A B C HS rs a A B C D E F GCC libavrxmega4g1 lt CH gt at k Ors a_ libavrxmega4g1 lt CH gt at k A B C D E GCC libavrxmega3g1 CH qt k Ors a libavrxmega3g1 lt CH gt at k A B C HS rs a ATxmega16a4 A B C HS rs a ATxmega16d4 A B C HS rs a ATMEL QTouch Library User Guide Page 63 Rev 8207G AT42 12 09 AMEL 7 1 5 Port combinations supported for SNS and SNSK pin configurations AVRs have a variety of GPIO ports available and they can be used Tor QTouch acquisition method touch sensing by having the SNS and SNSK pins connected on these GPIO ports NOTE If the SNS and SNSK pins are assigned on the same port for tinyAVR megaAVR and XMEGA devices then the maximum number of channels available on a single port is 4 For such cases the 8 channel library for the specific device has to be used NOTE If SNS and SNSK pins are to be assigned within the same port for tinyAVR megaAVR and XMEGA devices and more than 4 channels are needed then two ports have to be used For such cases the 16 channel library for the specific device has to be used 7 1 5 1 Port combinations
61. EL v1 v3 xmega uc3a VersionP of the core AVR device supported by this library variant uc3b G GroupQ of the core AVR device supported by this library variant 4 8 16 32 Total number of channels supported by each library 1 2 4 8 Total number of rotors sliders supported for the respective channel counts mentioned in previous row The configuration sets for AVR Studio IDE are named according to the convention listed below Configuration set for AVR Studio IDE avrP g Q CH qt K RS rs Field Values Comments Name avrP avr25 avr4 avr 51 avr5 VersionP of the core AVR device supported by this library variant xmega uc3a uc3b Q 1to6 GroupQ of the core AVR device supported by this library variant HS 1 2 4 8 Total number of rotors sliders supported for the respective channel counts mentioned in previous row Depending on your need you need to select the right configuration required and build the project SRR Embedded Workbench IDE File Edit View Project Tools Window Help IneHg S x amp eoc E uh Ow GRE WS mE DER EE x ko I LU libvTgl Bat k rs r90 B libi gi Bat k 2rs 90 HH main attiny amp 4 c v La 1 Output Figure 11 Selecting the right configuration in the GTouch acguisition method example applications in IAR IDE ATMEL QTouch Library User Guide Page 45 Rev 8207G AT42 12 09 AIMEL avr gi qt example Project Options Edit
62. GCC libavrxmega6 8qm 4x 2y krs 2rs YL LO NIB a 16 4x4 0 1 2 3 IAR libvbxm 16qm 4x 4y K Ors YL LO NIB r90 GCC libavrxmega6 16qm 4x 4y k Ors YL LO NIB a 0 1 2 3 IAR libvbxm 16qm 4x 4y krs 2rs YL LO NIB r90 GCC libavrxmega6 16qm 4x 4y krs 2rs YL LO NIB a LIEN 0 1 2 3 libvbxm 16qm 4x 4y krs 4rs YL LO NIB r90 GCC libavrxmega6 16qm 4x 4y krs 4rs YL LO NIB a KM Se o jo AR libv5xm_16qm_8x_2y k Ors YL LO NIB r90 GCC libavrxmega6_16qm_8x_2y k Ors YL LO NIB a 2 dl 2 eto libvbxm 16qm 8x 2y krs 2rs YL LO NIB r90 GCC libavrxmega6 16qm 8x 2y krs 2rs YL LO NIB a Sepe 4 jo libvbxm 16qm 8x 2y krs 4rs YL LO NIB r90 GCC libavrxmega6 16qm 8x 2y krs 4rs YL LO NIB a me Im 0 1 2 3 i i 0 1 2 3 os 32qm 8x 4y krs 4rs YL LO NIB r90 GCC libavrxmega6 32qm 8x 4y krs 4rs YL LO NIB a 4566 7 2 4 2 14 QMatrix acquisition method Library Variants for ATxmega128A1 Legend NC Number of channels Nx x NY Number of X x Y channels NRS Number of Rotors amp Sliders NC NXx Y line Compiler Library to be used Code Data NY pins memory Memory Y LINES ATxmega128A1 IAR v6oxm GCC avrxmega7 Vd ui libv6xm 8qm 4x 2y k Ors YL LO NIB r90 GCC libavrxmega7 8qm 4x 2y k Ors YL LO NIB a e i e libv6xm 8qm 4x 2y krs 2rs YL LO NIB r90 libavrxmega7 8qm 4x 2y krs 2rs YL LO NIB a eee jo foras PAR re AB ee libavrxmega7 16qm 4x 4y K Ors YL LO NIB a 2910 0 1 2 3 libv6 xm_16qm_4x_4y_krs_2rs_YL_LO_NIB r90 3872 ATMEL QTouch Lib
63. ITIS ERR E 58 TAZ Support for different compiler tool chains esse eee 58 7 1 3 QTouch Acquisition method library naming conventions eese nennen 58 7 1 3 1 Naming convention for libraries to be used with WinAVR GCC tool chain sees eee ee eee eee 58 7 1 3 2 Naming convention for libraries to be used with IAR EWAR cccccccccceccccceeceeeeeaeeeeseeeeeeeceeeeeeeeeeeaaaaaeeeees 59 7 1 4 QTouch acquisition method library variants esses eene eene eene nnn nnne nennen 59 7 1 5 Port combinations supported for SNS and SNSK pin configurations eee eene 64 7 1 5 1 Port combinations supported for single port pair SNS and SNSK pin configurations eee eee eee eee eee 64 7 1 5 2 Tips on pin assignments for the sensor design using one pair of SNS SNSK DOIS 65 ATMEL QTouch Library User Guide Page 3 Rev 8207G AT42 12 09 AMEL 7 1 5 3 Port combinations supported for two port pair SNS and SNSK pin configurations 66 7 1 5 3 1 Port combinations when using ports A to G on devViCGS sese eee 66 7 1 5 3 2 Port combinations when using ports D to K on deViCGR sese eee 67 7 1 5 4 Tips on pin assignments for the sensor design using two pairs of SNS SNSK ports esse 67 7 1 6 Sample applications and Memory requirements for QTouch acquisition method libraries 66 7 1 6 1 WinAVR GCC compiler tool chain memory footprint for QTouch acquisition method libraries 68
64. In the definition There is one instance where the library breaks this rule of a function like macro each where two macro definitions are combined to form a instance of a parameter shall different symbol name Usage of parenthesis cannot be be enclosed in parenthesis used in this scenario Rule states that there shall be There is one instance in the library where this rule is at most one occurrence of the violated where the library concatenates two macro or preprocessor operator in definitions to arrive at a different definition a single macro definition 10 Known Issues QMatrix Touch Sensing on XMEGA AVRs Suggested to use combinations with The Pins PE6 PE7 and PF5 of other ports ATxmega xxx A3 devices do not work for touch sensing when tested along with STK600 GCC Compiler Issue for ATmega128RFA1 device The Latest GCC WinAVR 20090313 is having In the linker options for the GCC project of ATmega128RFA1 device the following options have to be GCC compiler Optimisation issue with Suggested to use the default QMatrix Libraries on ATtiny167 Optimization level of O0 for In case of QMatrix GCC library for ATtiny167 ATtiny167 in case of GCC few channels produces low signal and reference value compared to other channels when tested with STK600 ATMEL QTouch Library User Guide Page 100 Rev 8207G ATA42 12 09 AMEL problems with ATmega128RFA1 device It added places the data section to the memory locat
65. L LO NIB r90 libavr5g3 16qm 4x 4y K Ors YL LO NIB a libv3g3 16qm 4x 4y k Ors YL HI NIB r90 libavr5g3 16qm 4x 4y k Ors YL HI NIB a libv3g3 16qm 4x 4y krs 2rs YL LO NIB r90 libavr5g3 16qm 4x 4y krs 2rs YL LO NIB a libv3g3 16qm 4x 4y krs 2rs YL HI NIB r90 libavr5g3 16qm 4x 4y krs 2rs YL HI NIB a libv3g3 16qm 4x 4y krs 4rs YL LO NIB r90 libavr5g3 16qm 4x 4y rs 4rs YL LO NIB a libv3g3 16qm 4x 4y krs 4rs YL HI NIB r90 libavr5g3 16qm 4x 4y krs 4rs YL HI NIB a E libv3g3 16qm 8x 2y k Ors YL LO NIB r90 2220 0 1 2 3 4x2 2 4x2 2 ibavr5g3_ 16qm 8x 2y k Ors YL HI NIB a Ts 16qm 8x 2y krs 4rs YL LO NIB r90 libavr5g3_16qm_8x_2y krs 4rs YL LO NIB a libv3g3 _16qm_8x_2y krs 4rs YL HI NIB r90 libavr5g3 16qm 8x 2y krs 4rs YL HI NIB a libv3g3 32qm 8x 4y k Ors YL LO NIB r90 libavr5g3 32qm 8x 4y k Ors YL LO NIB a libv3g3 32qm 8x 4y K Ors YL HI NIB r90 libavrbg3 32qm 8x 4y k Ors YL HI NIB a libv3g3 32qm 8x 4y krs 4rs YL LO NIB r90 3590 696 libavrbg3 32qm 8x 4y krs 4rs YL LO NIB a libv3g3 32qm 8x 4y krs 4rs YL HI NIB 90 3590 696 libavrbg3 32qm 8x 4y krs 4rs YL HI NIB a LIAR libv3g3 64qm 8x 8y k Ors YL LO NIB r90 2280 966 libavr5g3_16qm_8x_2y_k Ors YL LO NIB a 2790 Md libv3g3 16qm 8x 2y k Ors YL HI NIB r90 2220 16 8x2 2 Mii 8x2 4 64 8x8 ATMEL QTouch Library User Guide Page
66. O PA1 pins channel 1 will be on PA2 PA3 pins and so on up to channel 8 will be on PA14 Page 65 Rev 8207G AT42 12 09 ATMEL megaAVR XMEGA devices upto 8 PA15 pins The even pins of the port are used as SNS pins and odd pins channels with SNS and SNSK on of the port are used as SNSK pins same ports refer to section 7 1 5 3 7 1 5 3 Port combinations supported for two port pair SNS and SNSK pin configurations This section lists the possible two port pair combinations supported for the various touch library variants This section can be used as a reference when using the 16 channel libraries for tinyAVR megaAVR and XMEGA devices If a device supports a number of ports not all combination of ports will be supported to be used as SNSK1 SNS1 8 SNSK2 SNS2 ports 7 1 5 3 1 Port combinations when using ports A to G on devices The valid SNSK1 SNS1 8 SNSK2 SNS2 port combinations for libraries supporting a subset of the ports A B C D E F amp G are given below NOTE Port pair convention followed in the table below MN OP M Port used for SNSK in pair 1 N Port used for SNS in pair 1 O Port used for SNSK in pair 2 P Port used for SNS in pair 2 Ports Available AG AG AG AG AG AG AG A AG 34 AG AG AG AG AG_ AG_ 4 AG BG ase 22 sie E BE U Lee DE Ge BE DD CD BD CC BC BB FF BG BG BG BG BG BG BG 3 BG 3 BG BG BG BG BG BG CG CG CG EF DF CF AF LEE DE CE AE DD CD AD CC AC AA FF EF EDE CG CG CG
67. QMatrix channel in units of pulses Default value 64 pulses These values can be configured for each channel individually The signal gain for each sensor is controlled by circuit parameters as well as the burst length The burst length is simply the number of times the charge transfer QT process is performed on a given sensor Each QT process is simply the pulsing of an X line once with a corresponding Y line enabled to capture the resulting charge passed through the sensor s capacitance Cx The QMatrix acquisition method library exports a variable of this type which can be accessed to set the burst length for each of the QMatrix channels ATMEL QTouch Library User Guide Page 17 Rev 8207G AT42 12 09 AMEL ni extern uint8 t qt_burst_lengths QT_NUM_CHANNELS 6 3 5 tag sensor t structure tag sensor t Input Output Output from the library Use Data structure which holds the internal sensor state variables used by the library Fields 1 1 Type Comment internal sensor state general purpose counter used for calibration drifting etc drift Integration counter sensor detection threshold type aks pos hyst uint8 t holds information for sensor type AKS group positive recalibration flag and hysteresis value Hysteresis B2 positive recalibration flag B5 B3 AKS group B7 B6 sensor type starting channel number for sensor ending channel number for sensor 6 3 6 qt lib siginfo t structure qt lib siginfo t In
68. RT YA PORT YB PORT SMP BIT Channels configuration SMP supported by the library variant 8came 4x2 X YLIONE C JB a Ja 7 8 channel 4x2 VLIONB D 8 A a 7 8came 4x2 YLIONB D Jc Ja Ja 7 8came 4x2 YLIONE C D a Ja 7 ITD TD TV 8came TAS YLH NB C TRAR 8came 4x2 YLHINB o s a A Do 8came 4x2 YLHINB o Jc a A 0 Scame 4x2 YLHNNB C JD Ja Ja 0o E e uL eec TED 6came 4x4 YLIONE D c a Ja 7 i6came 4x4 X TRO NR TR JD a A 7 ITD dT TV 6came 4x4 YLH NB o Joc a a 0 6came 4x4 YLHINB C JD Ja Ja 0o came 4x4 X YLHINB o s fa A 0 rie channel 4x4 YLHNNB C Js fa A 0o TD TIT TV i6came TRS X YLIONE C TRAR ri channel 8x2 YLIONB D B A Ja 7 i6came 8x2 X YLIONB D Jc Ja Ja 7 ri channel 8x2 YLIONE C D fa Ja 7 H H RR NN i6came 8x2 YLHINE C X B Ja Ja 0 rie channel 8x2 YLHINE D Js a A 0 rie channel 8x2 X YLHINE o c a A 0 ri channel 8x2 YLHINE C JD a Ja 0o mn ch O H I 1 4 S2chme 8x4 YLIONE D c Ja a 7 32 chamel 8x4 X TRO NR TR D a A 7 DE ULL LE ITD TV S2cme 8x4 YLHINE o Jc Ja A 0 32chme 8x4 X YLHINE C JD Ja Ja 0o 32 channel 8x4 YLHINE D Js a A 0 32came 8x4 X YLHINE C B a a D ATMEL QTouch Library User Guide Page 91 Rev 8207G
69. SNS or SNSK pin number 2 o Fore g pins 4 and 5 are connected to a SNS SNSK pair and the channel number associated with the SNS SNSK pin is 2 gt Pin O Port A Pin 1 Al Pin 2 SNSK Pin 3 and SNS pins Pin 4 terminated Pin 5 on the same port Pin 6 SNS pin channel 0 sus pin SNS pin channel 1 SNSK pin sensor1 SNS pin channel 2 snsk pin SNS pin channel 3 SNSK pin C sensor2 u N Figure 8 Channel numbering for GTouch acquisition method when the SNS and SNSK pins are connected to the same port ATMEL GTouch Library User Guide Page 27 Rev 8207G AT42 12 09 AMEL 6 5 1 2 Channel numbering when using QMatrix acquisition method Cho Ch 4 XO yee ROTOR SLIDER Zi i i i X1 zi SL ena Ch 13 O iz on 2 EE X i nt KZ HDD Ch3 chap ch f1 chas X3 y Jj Ko Vi P NV b ar YO Y1 Y2 Y3 QMatrix also supports such rotor slider configuration QMatrix Channels The channels selected for a Rotor Slider MUST be on a single YA YB line Figure 9 Channel Numbering for QMatrix acquisition method libraries Figure 9 illustrates a QMatrix capacitive sensing solution which uses 4 X lines and 4 Y lines thereby providing a 16 channel solution Note The choice of ports for X and Y lines are determined by the availability of the QMatirx acquisition method libraries
70. Set library channel signal data mean of last 4 values T for i 0u i lt QT_NUM_CHANNELS i filter i JO filter i 1 filter i 1 filter i 2 filter i 2 filter i 3 filter i 3 qt measure data channel signals i qt measure data channel signals i filter i O filter i 1 filter i 2 filter i 3 4u The signal values processed by the ATMEL OTouch Library are now the mean of the last four actual signal values 6 6 Constraints 6 6 1 QTouch acquisition method constraints QTouch acquisition method libraries are available for a set of AVRs and port combinations These port combinations have fixed port assignments for SNS and SNSK pins required Some of the key constraints are e Rotors sliders have to be connected on three adjacent channels e g 1 2 3 or 3 4 5 within the same port Possible combinations are 0 1 2 1 2 3 for a configuration which supports 4 channels Possible combinations 0 1 2 1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 for a configuration which supports 8 channels ATMEL QTouch Library User Guide Page 33 Rev 8207G AT42 12 09 AMEL 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 g It is not possible to have a rotor with channel numbers 7 8 9 on a 16 channel library variant which uses two port pa
71. a Sees een 13 6 2 2 1 BNO I MM TEE acne cua enamel SE EP OO ted coke boca CE IH 13 0 SP EST CN e NUR ER 14 6 2 2 3 STT NN THT 14 see T MY SOTO SLE T 15 6 2 2 5 KO SONDI ONE TTT 15 6 2 2 6 fecal UMM INO NG PTT 15 6 3 TTU IE 16 6 3 1 Ol TOMO SSAA TTT 16 6 3 2 d touch O CO EILEEN 16 6 3 3 g touch MD measure ia Teosi E E E A given sadesntaene obit 17 6 3 4 E ABL NM SNR 17 6 3 5 KG META T E EE 18 6 3 6 TUERI DONNE ET T 18 6 4 PUBLIC FUNCTION S iseascnidipieniidtesssetiu ome ndine nace BOJA BAJA AA EE SEE EEEO 19 6 4 1 I RED HIE 19 6 4 2 CL OVI TY T 20 6 4 3 ECV OV OT a E E H 20 6 4 4 GUISEA DI CSAC T 21 6 4 5 TW UM OU M 21 6 4 6 d Mea ure SOS OTS sesetasjesvetvsvesiiisetestsnt O DIEM SUN S DP oleto dama a get es a 22 6 4 7 glealibrate ETH OE aasan ssc castacseanneaassossianseaseacas anit aia tanaeon ON Ea EASES EAA Aaaa 22 6 4 8 GEV TTT 23 6 4 9 JI POI Sensor TTT 23 27 BELLES E T A ETE TC rer Er reer eee re LETTERE 23 6 5 OVERVIEW OF TOUCH API USAGE AND SEQUENCE cccccsssecccccessecccccausecceceeusecccesauseececsauecceesaueecceeeaueeeeees 24 6 5 1 Channel IN 2s ME H 25 6 5 1 1 Channel numbering when using QTouch acquisition method sse 25 6 5 1 1 1 Channel numbering when routing SNS and SNSK pins to different DOS 25 6 5 1 1 2 Channel numbering when routing SNS and SNSK pins to the same DOT sees ee
72. aatrix acquisition method Library Variants for ATmega324P cccccccccccccccccceeeeeesesssseeeeeeeeeeeeeeeeeaaas 82 7 2 4 2 9 QMaatrix acquisition method Library Variants for A Tmegaa32ADA 83 7 2 4 2 10 QMatrix acquisition method Library Variants for ATmegal28RFA LT eee 84 7 2 4 2 11 QMatrix acquisition method Library Variants for ATXMega64A3 eee 85 7 2 4 2 12 QMatrix acquisition method Library Variants for ATxmega64A l1 eee 86 7 2 4 2 13 QMatrix acquisition method Library Variants for ATxmegal28A3 ATxmegal92A3 oo estes 87 ATxmeea250A ATxmepaZ36A3SD 2 caiciciriccsicssadasaniracceaneasdorinssaatonesansseateirandeaeicaedasannaranchinaneaacavoneaeniiaatasbetamaasiwen latent 87 7 2 4 2 14 QMatrix acquisition method Library Variants for ATxmegal 25A 87 7 2 4 3 Device configurations supported by the QMatrix acquisition method library variantS 4 4 4 4 4 4 440 88 7 2 4 3 1 Device configuration supported for ATtiny88 sss sese 88 7 2 4 3 2 Device configuration supported for ATtiny 167 ccccccccccccecccceeeeeeeeeeeeseeecceeeeeeeeeaeeeaaaaeeeseeeeeeeeeeseneeeeaas 89 7 2 4 3 3 Device configuration supported for ATmegal6 ATmegal6A sse 89 7 2 4 3 4 Device configuration supported for ATMega8535 cccccccccccccsssssssssssseeecceeecceeeceeeeaaaeasesseseseeeeeseeeseeeaaagees 90 7 2 4 3 5 Device configuration supported for ATmega88P A TmegassPA eene eene nennen 90 7 2 4 3 6 Device configu
73. annel 8xZ YLHLNIB AU OT BUT FEF 16 channel 8xZ YL HNR AUT CCU FEF 16chame 8xZz VLLHLNIB AU D _ F JF JO _ 186 channel 8xZ YLHNB A E JF JF Jo _ 16chamd 8xZ YLHNB B A JF JF JO _ 16chame 8x2 YLHNB C A F JF JO 16chamd 8xZ YLHNB D A JF JF Jo X 16chamd 8xZ YLHNB B C JF JF Jo X 16chamel 8xZz YLHNB TB D F X F O _ 16chamd 8xZ YLHNB B E JF X F Jo X 16chamd 8xZ YLHNB C B JF JF Jo X 16chamd 8xZ YLHNB D B F JF Jo 16chamd 8xZ YLHNB C D JF JF Jo X 16 channel 8xZ YLHNB C E JF JF Jo X 16chamel 8xZ YLHNB D C F X F O 16chame 8xZ YLHNB D E F X FO KI as I I I GO I E EF E ITI m GO Ti T lO OO OIC TT TI TI TI n TI TI TI n TI TI TI n m TI TI 71 G 0 0 0 GD GI GI GI C G C0 C0 CO CO CO CO QO S m O TH Ty TI nL m n n n n n n n n m TI TH Ty TY nL m n n n n n m n n TI TI ATMEL GTouch Library User Guide Page 93 Rev 8207G AT42 12 09 AMEL 32 channel 8x4 YLIONB A BO F _ JIG JO _ 32chamd 8x4 YLLIONB A CUT FOG 32chamd 8x4 YLLONB JA C JF JG Jo _ 32chame 8x4 YLIONB A DOT FOG 32channel 8x4 YLLLO NIB_ BO JA OUT FOG 32cham
74. ation 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 libraries The user might be required to change this setting for debugging purposes o Incase of IAR The optimizations tab in project configuration options specifies High o Incase of GCC the libraries are compiled with the Os which signifies that the Optimization for generating the library is maximum Options for node v1g1 qt example Category Factory Settings General Options Multi file Compilation Assembler Custom Build Language Code Optimizations Output List Preprocessor D_4 gt Build Actions Linker e Size High Maximum optimization Debugger AVR ONE None Best debug support CCR ICE200 V Common Ugly NES ni g JTAGICE Function inlining JTAGICE mkII Code motion a Dragon Cross call v Simulator Third Party Driver Number of cross call passes 2 Y Always do cross call optimization Figure 22 Specifying the optimization level in IAR IDE ATMEL QTouch Library User Guide Page 55 Rev 8207G AT42 12 09 AMEL 6 10 7 Debug Support in Example applications The EVK2080 and QT600 applications provide output debug information on standard GPIO pins through the USB bridge IC to PC software for display by AVR QTouch Studio For ATMEL devices that are not supported through EVK or QT60
75. atrix acquisition section 7 2 4 3 PORT_YB As defined in the port configurations Drive electrode for touch sensing supported for the device selected in using QMatrix acquisition section 7 2 4 3 PORT SMP As defined in the port configurations Drive electrode for touch sensing supported for the device selected in using QMatrix acquisition section 7 2 4 3 SMP BIT As defined in the port configurations Drive electrode for touch sensing supported for the device selected in using QMatrix acquisition section 7 2 4 3 ROTOR SLIDER _ Symbol defined if Rotor and or slider is Needs to be added in case user required needs to configure ROTOR SLIDER Needs to be removed for ALL KEYS configuration DELAY CYCLES 1 2 3 4 5 10 25 50 Please refer to section 6 7 QT MAX NUM ROTORS SLIDERS 0 2 4 8 Subject to support for rotors sliders in the library selected See section 7 2 4 2 ATMEL QTouch Library User Guide Page 40 Rev 8207G AT42 12 09 AIMEL G _ATXMEGA _ Symbol defined if an XMEGA Device Needs to be added if the device to is used for QMatrix sensing be supported is ATxmegaxxxx technology Once you have selected the right library variant and configuration parameters for the application follow the steps outlined below to integrate the library variant in your application 5 Copy the library variant that was selected in step one to your project s working directory or update your project to point to the library selected 6 Include the t
76. b siginfo t Pointer to the structure which needs to be updated with the library signature information NOTE e he function qt measure sensors should have been called at least once prior to calling this function ATMEL QTouch Library User Guide Page 23 Rev 8207G AT42 12 09 AMEL 6 5 Overview of Touch API Usage and sequence Figure 1 illustrates the sequence of operations required to be performed to add touch to an end application By using the simple APPs as illustrated in the sequence below the user can add touch sensing in his design qt_reset_sensing The host application optionally calls gt_reset_sensing to reset all channels and touch sensing parameters to their default states This step is only required if the host wants to dynamically reconfigure the library at runtime qt_enable_xxx The host application calls qt_enable_key qt enable rotor and or qt enable slider as required to configure the touch sensors qt init sensing The host application calls qt init sensing to calibrate all the configured channels and prepare the sensors for capacitive measurement qt set parameters The host application qt set parameters to initialize the threshold parameters for the library If the user needs to change the thresholds edit the global data structure qt config data prior to calling this API init timer isr The host application initializes the timer module required for capacitive
77. braries ensure the following ATMEL QTouch Library User Guide Page 42 Rev 8207G AT42 12 09 AMEL Check that the CLKPR register is available for the selected device If not remove the CLKPR statements MCUCR register is available and if so disable pullups Check if the timer registers and bitfields used are correct and change them if necessary The above settings can be modified by the user by changing the API s that are available to the user The API s include o qt set parameters The host application must provide the current time This information is passed to the library as an argument to the function qt measure sensors This is used for time based library operations such as drift compensation The GPIO internal pull ups must be disabled for all port pins used for touch sensing when calling the library For 8 bit AVR devices this can be done by a Setting the PUD bit in the MCUCR register or b Setting the PUD bit in the SFIOR register c Setting the JTD bit in the MCUCR register to disable JTAG if available This can be done only when the JTAG lines are in conflict with the touch sensing lines e The library must be called often enough to provide a reasonable response time to user touches The typical time to call the library is from 25 ms to 50 ms 6 9 4 Common checklist items 6 9 4 1 Configuring the stack size for the application The stack requirements for the QTouch library should be account
78. citor aras Figure 2 QTouch Acquisition QTouch acquisition method sensors can drive single or multiple keys Where multiple keys are used each key can be set for an individual sensitivity level Keys of different sizes and shapes can be used to meet both functional and aesthetic requirements NOTE It is 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 Touch Design Guide for details QTouch acquisition method can be deployed in two ways e normal touch contact i e when pressing buttons on a panel and e high sensitivity proximity mode i e when a panel lights up before you actually contact it QTouch circuits offer tremendous signal to noise ratio very good low power performance and the easiest sensor layout ATMEL QTouch Library User Guide Page 9 Rev 8207G AT42 12 09 AMEL 5 2 1 1 Sensor schematics for a QTouch acquisition method design Sampling capacitor SNSK PB1 Rs Microcontroller Used for touch licati application Cs PC1 SNS Electrode Typical Rs 1k values CS 22nF Port requirements SNS generic I O pin SNSK generic I O pin Rs Series resistor Cs Sample capacitor PB1 PortB bit1 and PC1 PortC bit1 Figure 3 Schematics for
79. configuration e Device tinyAVR or megaAVR device belonging to core group v3 e Belongs to a set of devices of group 3 supported by this library e Support a maximum of 4 channels 7 1 4 QTouch acquisition method library variants Table 8 lists the different QTouch acquisition method library variants supported for AVRs Use this table to select the correct library variant to be used in your application Each row in the table below indicates e the AVH for which the library is supported the corresponding Ports available for SNS and SNSK pins Compilers used for generating the libraries The library names to be selected for the requirements Note he libraries that are supported as listed in the table are only supported provided the device memory requirements are also satisfied Naming convention of the library Maximum channels supported by the library ATMEL QTouch Library User Guide Page 59 Rev 8207G AT42 12 09 AMEL Device Range tinyAVR megaAVR XMEGA 4 8 16 UC3 8 16 32 Maximum number of rotor sliders supported NOTE e 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 for each port Table 8 QTouch acquisition method library variants Library to be used K Library to be used KRS Supports only keys Supports keys rotors and Com piler Device sliders IAR GCC Attiny44A A B IAR GCC
80. device Since the application requires 6 channels and rotor slider support one has to select a library variant which supports atleast 6 channels or more Hence we select the 8 channel library which supports the required Port combination and the delay cycle preferred which works out to be the variant e lib t88 8qm 4x 2y Krs 2rs YL LO NIB r90 Step 2 Defining the constants symbols in the project space In the host application file say main c define the following constants and symbols define QMATRIX define QT NUM CHANNELS 8 define PORT X B define PORT YA D define PORT YB C define PORT SMP D define SMP BIT Z define DELAY CYCLES 4 define ROTOR SLIDER Adefine QT MAX NUM ROTORS SLIDERS 2 NOTE 1 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 2 In case XMEGA device is used for QMatrix the symbol ATXMEGA has to be included in the Project space along with the symbols mentioned above Step3 Usage of libraries Now you can use the touch API s to create initialize and perform touch sensing Please refer to the sample applications in section 6 10 3 for reference These sample applications illustrate the usage of the API s and the sequence of operation 6 9 3 3 Checklist of items for integrating QMatrix Capacitive sensing libraries When integrating QMatrix acquisition method li
81. e 23 Enabling Debug Support for the library in IAR IDE WINAVR GCC In the Project configuration Options gt Custom Options gt Add the Directive D_DEBUG_INTERFACE ATMEL QTouch Library User Guide Page 56 Rev 8207G AT42 12 09 SE i Remove eren u99 Include Linker Options Directories D_ROTOR_SLIDER_ T BE ski funsigrned zhar funsigned bitfield come fpack struct Libraries Fhart enums 5 p Memory Settings gt External Tools Custom Options Iw Use wind A awr gec CAWindVR 2009031 3 bin avr qec exe make CAWindVR 2009031 3hutils binkmake exe Cancel Help Figure 24 Enabling Debug support for the library in AVR Studio IDE 6 10 7 3 Debug Interface if USB Bridge board is not available For the sample applications using the devices that are not supported on EVK2080 and QT600 the debug interface code is not provided This is because a separate USB bridge board is required to read the data and display it on QTouch studio However in this case the output touch measurement data can still be viewed using the IAR or AVR Studio IDE when running the code in debug mode using debug wire or emulator extern qt touch lib measure data t dL measure data The qt measure data global variable contains the output touch measurement data Refer to section 6 3 3 for more information on the data type For GCC generated libraries the output touch measurement data can be observed on the watch window through
82. e configuration to be used a new configuration can be added to the project 3 If a different variant of the library needs to be used remove the existing library in that particular configuration and add the library variant that you require Please refer to 7 1 4 for details on the different library variants Update the linker options to specify the library to be linked 4 Specify the tunable configuration parameters for the project as illustrated in sections 6 10 2 2 and 6 10 2 3 6 10 3 Example applications for QMatrix acquisition method libraries The QMatrix acquisition method libraries include example projects for some of the supported devices e Example projects for both IAR IDE and AVR Studio IDE along with example applications are provided for select devices using the QMatrix acquisition libraries e These sample applications demonstrate the usage of the touch API s to add touch sensing to an application e The list of devices and the supported configuration flavors for IAR IDE and AVR Studio IDE are listed below Example Project for IAR Project Configuration flavors supported Example projects provided for QMatrix acquisition method libraries for IAR IDE 188 qm 16ch 8x 2y krs drs Ylow m88 qm 32ch 8x 4y Krs drs Ylow m 16 qm 16ch 8x 2y Krs drs Yhigh m 64p qm 32ch 8x 4y krs 4rs Ylow m 65p qm 32ch 8x 4y krs 4rs Ylow m324p qm 64ch 8x 8y krs 4rs Ylow m324p qm 64ch 8x 8y krs 8rs Ylow m8535 qm 16ch 4x 4y krs 4rs Yhigh TS2080B Ti
83. e ee 3 12 Yes S O Number of Rotors and Sliders required Each rotor slider will require 3 channels Number of Channels required for the 3 Keys 3 rotors x 3 channels application should be the sum of all per rotor slider gt 12 channels channels required for all the keys rotors and sliders used in the design Charge cycle time required for the 5 cycles Assuming the device IS design configured with a clock freguency of 8Mhz Number of SNS SNSK port pairs 2 pairs This is determined based on the needed number of channels reguired and the routing required for the channels SNS and SNSK pins to the ports For this design since more than 8 pins are required we need 2 pairs of ports to support the required number of ports Choice of ports available for the SNS SNSK SNS1 Port D The choice of ports for the port design Pair1 port pairs is limited and can be found SNSKI Por B in the section 7 1 5 SNS SNSK Pair SNS2 Port C 2 port SNSK Port A 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 By following the guidelines listed for library selection in 7 1 4 we see that there are a few variants of libraries supported for ATmega1281 Since the application requires 12 channels and rotor slider support one has to select a library variant which supports at least 12 channels or more along with Rotors Slider
84. e eee 27 6 5 1 2 Channel numbering when using QMatrix acquisition method sees 28 ATMEL QTouch Library User Guide Page 2 Rev 8207G AT42 12 09 0 5 2 NY IPIS e PH Ade E TE 30 6 5 3 CSC T anges ea a ah sashes ge sas anesthe TT SER 31 Oaol Avoine Br cul STRE eee 31 RS PU R Ce 9 rre Inr BETTE TEE 3l 63 33 Adjacent Key SUDDICSSI IT ood bern hori ar etd ie En ER bit Sira RISO ed ide Fun NH DOCS onu RO n a eo S CU oU pd p UNE TR aiee 3l 5 3 2 Multiple 1 T DUC TIS sed oerte turbet attri iore ietubba tei anos ue diate i ehcazete E deeper Abe on fiestas UU Ia aeaieie 32 hE in EI RES 32 6 2 5 0 Filteritie senal Measurements sccicucortersnAsccnsseiernesndeensecaunleaheenckiteccutes tasdechabreceinabtdecceea Ea a2 6 5 3 6 1 Example Averaging the Last Four Signal Values cccccccccccccccceseeessseeseeceecceeecseceeeeaaaaaseseeeeeeeeeeeeeess 33 oC mmm Surg 33 6 6 1 OTouch acquisition method constraints eese esses eene nnne e ense senes n nnn nnne nenne nns 33 6 6 2 OMatrix acquisition method API constraints sese eee 34 6 7 FREQUENCY OF OPERATION VS CHARGE CYCLE DWELL CYCLE TIMES see eee 35 Do ITER ROD P 35 6 9 INTEGRATING QTOUCH LIBRARIES IN YOUR APPLICATION sese ee 36 6 9 1 Directory structure of the library files aaaea aa Taa aaa aaa THARA Rada 36 6 9 2 Integrating QTouch acquisition method libraries in your applicati
85. e level has reached gt 98 of maximum reference value seen with a much longer cycle time If the cycle time is too short the design may experience temperature sensitivity Example When operating at 4 MHz 1 10 cycle charge times are recommended 0 125us to 1 25us So when operating at 4MHz the user can update delay cycles with any of 1 2 3 4 5 10 Table 2 Frequency of operation Frequency of microcontroller Cycle time Suitable Charge Cycle times or Microcontroller us Suitable Dwell Cycle times MHz c 18 Lt 1 2 1 2 cycles 1us to 2us 1us to 2us d 8 5 155 n 0 5us to 2 5us 1 10 cycles 0 25us to 2 5us 0 125 1 10 cycles 0 125us to 1 25us 2 25 cycles 0 2us to 2 5us MK 0 0625 2 25 cycles 0 125us to 1 5625us 3 50 cycles 0 15us to 2 5us Note e For UC3 devices o 1 charge cycle delay time is not supported when using IAR IDE o 182 charge cycle delay times are not supported when using GCC compiler tool chain If the AVR is only used for Touch detection then running at the lowest frequency possible for the desired touch response may provide the best power and EMC performance If the AVR is also used for other functions then running at a higher frequency may be necessary In some power critical applications it may be worth switching the frequency on the fly such as lowering the frequency during touch detect API instead of using long cycle times and then switching
86. e shoot common issues Misra Compliance Report Provides details on the Mira compliance of the QTouch libraries 0 Known Issues Provides details on known issues with the touch library 1 Revision History Provides a revision history of this document PUNS e p uma ae ATMEL QTouch Library User Guide Page 6 Rev 8207G AT42 12 09 AMEL 4 Abbreviations and Definitions 4 1 Definitions AVR refers to a device s in the tinyAVR megaAVR XMEGA and UC3 microcontroller family ATMEL QTouch Library The combination of libraries for both touch sensing technologies QTouch and QMatrix QTouch Technology A type of capacitive touch sensing technology using self capacitance each channel has only one electrode QMatrix Technology A type of capacitive touch sensing technology using mutual capacitance each channel has an outer output electrode X and an inner input electrode Y Sensor A channel or group of channels used to form a touch sensor Sensors are of 3 types keys Rotors and Sliders KEY a Single Channel forms a single KEY type sensor ROTOR a group of channels forms a ROTOR sensor to detect angular position of touch o A Rotor is composed of 3 channels for a QTouch acquisition method o A Rotor can be composed of 3 to 8 channels for QMatrix acquisition method SLIDER a group of channels forms a SLIDER sensor to detect the linear position of touch o A Slider is composed of 3 channels for a QTouc
87. ed 8x4 YLLONB C JA F J G JO _ 32chamed 8x4 3 YLLONB D JA F J G JO 32chamd 8x4 3 YLIONB B C J F J JG Jo X 32chamd 8x4 3 Y IONB B D J F JG Jo X 32chamd 8x4 YLIONB C B X F JX G JO 32chamd 8x4 YLIONB D JB J F JG Jo X 32chamd 8x4 YLIONB C D JF JG Jo X E NB D C o IG E ee ee PT u 32chane 8x4 YLLHLNIB A BU 32 channel 8x4 YLHINB A J JD X 32chame 8x4 amp Y HINB B A 32chame 8x4 Y HNB D JA 32chanme 8x4 YLHNB B GU 32chame 8x4 YLHNIB B D X 32chame 8x4 YLHINB C B 32chame 8x4 A Y HNB D JB X 32chame 8x4 YLHNB C D 32chame 8x4 3 YLHNB D C mr iu A B ADO B JA NENNEN 64chamnel TB dT YLLONIB A Y YL LO NIB Y Y L LO NIB LLO NIB FF 64 channel 8x4 YLLONB D A JF 64 channel 8x4 YLIONB B C F G Jo 64 channel 8x4 YLIONB B D F G MD 64 channel 8x4 YLIONB C Js F ce MD 64 channel 8x4 YLIONB D Js F e D 64 channel 8x4 YLIONB C Jo F G D 64 channel 8x4 YLIONB D c F ce Do a a T S TMK MK NK H S G jo THE A F 19 3 F 0 J F JO F 0 E E RN Eo 19 F JO F 0 F p F 0 F 0 NENNEN MEN F G JO 9 yg F G JO 9 F G JO 9
88. ed for and the stack size adjusted in the user s project for proper operation of the software when using the IAR IDE This section lists the stack usage for the different variants of the QTouch and QMatrix acquisition method libraries applicable to the IAR compiler tool chain Note When using the IAR IDE compiler tool chain the map file generated for the application will list total CSTACK amp RSTACK requirements Please adjust the total CSTACK and RSTACK values in the IAR project options to be greater than the values listed in the map file Refer to section 6 10 4 which illustrates how to change the settings in IAR IDE Table 5 Stack requirements of the QTouch capacitive sensing libraries when using IAR IDE projects QTouch Acquisition method Libraries Stack usage for IAR compiler tool chain Configuration CSTACK size RSTACK size Single port pair only keys 4 8 channels Single port pair keys rotors sliders 4 8 channel Two port pairs only keys keys 16 channel Two port pairs keys rotors sliders 16 channel Table 6 Stack requirements of the QMatrix capacitive sensing libraries when using IAR IDE projects ATMEL QTouch Library User Guide Page 43 Rev 8207G AT42 12 09 AMEL QMatrix Acquisition method Libraries Stack usage for IAR compiler tool chain Number of Configuration CSTACK size RSTACK size channels s oree 6 10 Example project files The QTouch library is shipped with various exam
89. ega devices the resources are used internal to the library and hence cannot be used by the host application o Analog ComparatorO on PORTA ACO on PORTA o Timer Counter1 on PORTC TCC1 o Event System Channelo EVSYS CHO 6 9 3 2 Example The example below will explain in detail the steps to follow for library selection Criteria Microcontroller ATTiny88 List of supported devices can be found at 7 2 4 1 Number of channels required for number channels available for a Tiny88 is listed in the application section 7 2 4 2 1 Rotors and sliders required and Yes Library variants supported for ATTiny88 is listed in Number of ROTOR SLIDERS 2 section 7 2 4 2 1 Y_LINES on Lower pins or higher On lower pins of port Supported configurations for ATtiny88 is listed in ATMEL QTouch Library User Guide Page 41 Rev 8207G AT42 12 09 AMEL pins of port YL_LO_NIB section 7 2 4 3 1 Compiler tool chain Supported compiler tool chains listed in 7 2 2 Choice of ports available for the X Lines on PORTB Supported device configurations for X Y and SMP design YA Line on PORTD ports is listed in section 7 2 4 3 1 YB Line on PORTC SMP Pin on PORTD pin 7 DELAY CYCLES of 4 Given the above requirements for the applications the first step is to select the right library variant required otep 1 By following the guidelines listed for library selection in 7 2 4 2 1 we see that there are a few variants of libraries supported for AT Tiny
90. eger uint32 t unsigned 32 bit integer threshold t unsigned 8 bit integer used for setting a sensor detection threshold 6 2 2 Enumerations This section lists the enumerations used in the QTouch Library 6 2 2 1 sensor type t Enumeration sensor type t Use Define the type of the sensor SENSOR TYPE UNASSIGNED Channel is not assigned to any sensor SENSOR TYPE KEY sensor is of type KEY SENSOR TYPE ROTOR Sensor is of type ROTOR SENSOR TYPE SLIDER sensor is of type SLIDER ATMEL QTouch Library User Guide Page 13 Rev 8207G AT42 12 09 AMEL 6 2 2 2 aks_group_t Enumeration aks group t Use Defines the Adjacent Key Suppression AKS groups each sensor may be associated with see section 6 5 3 2 AKS is selectable by the system designer 7 AKS groups are supported by the library Values Comment Comment 6 2 2 3 channel t Enumeration channel t Use The channel numbers used in the library When using the QTouch acquisition method the channel numbers have a one to one mapping to the pin numbers of the port being used When using the QMatrix acquisition method the channel numbers are ordered in a matrix sequence pew Chamel number The maximum number of channels supported is dependent on the library variant Possible values of N are as listed below Acquisition method Device type Possible values of N Maximum number of channels QTouch acquisition 48 46
91. es for some of the JTAG Pins are channels does not display appropriate enabled in the target values ATMEL QTouch Library User Guide Page 98 Rev 8207G AT42 12 09 AIMEL 9 MISRA Compliance Report This section lists the compliance and deviations for MISRA standards of coding practice for the QTouch and QMatrix acquisition method libraries 9 1 What is covered The QTouch and QMatrix acquisition method libraries adhere to the MISRA standards The additional reference code provided in the form of sample applications is not guaranteed to be MISRA compliant 9 2 Target Environment Development Environment IAR Embedded Workbench V5 3 MISRA Checking software The MISRA C Compliance has been performed for the library using MISRA C 2004 Rules in IAR WorkBench V5 3 development environment 9 3 Deviations from MISRA C Standards 9 3 1 QTouch acquisition method libraries The QTouch acquisition method libraries were subject to the above mentioned MISRA compliance rules The following exceptions have not been fixed as they are required for the implementation of the library Full Teme Release RuleNo Rule Description Exceptionnoted Howitisaddressed 1 1 Rule states that all code shall This Rule is not supported as the library implementation conform to ISO 9899 standard requires IAR extensions like interrupt These intrinsic C with no extensions functions relate to device hardware functionality and perm
92. ethod libraries Symbol Constant Range of values Comments name QTOUCH This macro has to be defined in order to use QTouch libraries SNS amp SNSK As defined in the list of supported To be used if only single port pair is needed for the ports for the device selected in design section 7 1 5 3 1 SNS1 SNSK1 As defined in the list of supported To be used if two port pairs are needed for the amp ports for the device selected in design SNS SNSK2 section 7 1 5 3 QT NUM CHANNELS 4 8 16 for tinyAVR megaAVR and XMEGA device libraries and 8 16 32 for UC3 device libraries ROTOR SLIDER Rotor slider can be added to the A library with rotor slider functionality already design if this macro is enabled available needs to be selected if this macro is to be enabled QT DELAY CYCLES 1 2 3 4 5 10 25 50 Please refer to section 6 7 4 Using QTouch API s in your application to add touch functionality a The clock host application and other peripherals needed by the host application needs to be initialized b In your application create initialize and configure the sensors i The APIs of interest are qt enable key rotor slider see sections 6 4 2 6 4 3 and 6 4 4 c The channel configuration parameters need to be set by calling the qt set parameters see section 6 4 1 d Once the sensors are configured qt init sensing has to be called to trigger the initialization of the sensors with
93. h AKS group will be reported to be in detect The library provides the ability to configure any sensor to be included in any one of the Adjacent Key Suppression Groups AKS Group The AKS group number for a sensor is specified when the user enables the sensor using the API qt enable sensor rotor slider ATMEL QTouch Library User Guide Page 31 Rev 8207G AT42 12 09 AMEL 6 5 3 4 Multiple measurements The library will automatically perform multiple measurements on a sensor in certain conditions These include the following situations e When sensors are being calibrated e When a sensor is being filtered while going into or coming out of detect DI Chattering Debounce In such situations multiple measurements are performed by the touch library before returning to the host application This implies that some of the calls to perform sensor measurements might take a little bit longer 6 5 3 5 Measurement Limit In ATMEL QTouch library variants that use QTouch capacitive sensing measurements on a channel are automatically stopped when they reach a value of 8192 pulses In this case a signal level of 1 will be reported for the channel This limit is long enough for practical uses of QTouch sensing and traps hardware fault conditions such as shorted out sampling capacitors 6 5 3 6 Filtering Signal Measurements The ATMEL QTouch Library API provides a function pointer called qt filter calloack The user can use this hook to
94. h acquisition method o A Slider can be composed of 3 to 8 channels for QMatrix acquisition method AKS Adjacent Key Suppression See Section 6 5 3 3 SNS PIN Sense line for capacitive measurement using the QTouch Technology connected to Cs SNSK PIN Sense Key line for capacitive measurement using the QTouch Technology connected to channel electrode through Rs X Line The drive electrode or drive line used for QMatrix Technology Y Line The receive electrode or receive line used for QMatrix Technology Port Pair A combination of SNS port and SNSK port to which sensors are connected for QTouch technology The SNS and SNSK ports used in a port pair can be located in the same AVR Port 8 pins for 4 sensors or they may be in different 2 different AVR Ports 848 pins for 8 sensors Charge Cycle Period It is the width of the charging pulse applied to the channel capacitor Dwell Cycle In a QMatrix acquisition method the duration in which charge coupled from X to Y is captured Acquisition A single capacitive measurement process Electrode Electrodes are typically areas of copper on a printed circuit board but can also be areas of clear conductive indium tin oxide ITO on a glass or plastic touch screen ATMEL QTouch Library User Guide Page 7 Rev 8207G AT42 12 09 AMEL 5 QTouch Libraries 5 1 Introduction ATMEL QTouch provides a simple to use solution to realize touch sensing solutions on a range of supported
95. h and QMatrix acquisition methods Support upto 64 touch sense channels Flexible choice of touch sensing functionality keys sliders wheels in a variety of combinations Includes Adjacent Key Suppression AKS M technology for the unambiguous detection of key events e Support for both IAR and GCC compiler tool chains This user guide describes the content design and use of the QTouch Libraries This guide should be read in conjunction with all of the applicable documents listed below e Device datasheet for the selected AVR device used for touch sensing e Data sheet for the selected evaluation board The intended readers of this document are Engineers who use the QTouch Library on AVR Microcontrollers to realize capacitive touch sensing solutions 3 Overview This chapter gives a brief introduction to each of the chapters that make up this document Preface Introduction Provides an introduction to the scope and use of the QTouch Library Overview This chapter Abbreviations and Definitions Provides a description of the abbreviations and definitions used in this document QTouch Libraries Provides an overview of the QTouch libraries and the different acquisition methods QTouch Library API Provides details about the QTouch library Application Programming Interface Library Variants Provides details on the different variants of QTouch libraries available for AVRs Checklist Provides tips and a list of check list items to troubl
96. he user wishes to have a new name for the configuration to be used a new configuration can be added to the project 3 Ifa different variant of the library needs to be used remove the existing library in that particular configuration and add the library variant that you require Please refer to 7 2 4 2 for details on the different library variants Update the linker options to specify the library to be linked 4 Specify the tunable configuration parameters for the project as illustrated in 6 10 3 2 5 For QMatrix on XMEGA devices Please check if the pre processor symbol ATXMEGA is added in the project space or not 6 10 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 The usage of pins for QTouch is based on the channels that are being configured while enabling the sensors keys rotors sliders The example below configuring 4 keys a rotor and a slider shows how the pin configurability is achieved by configuring the sensor channels The code snippet configures a specific 10 channels of a 16 channel library based on the GPIO port pins available for QTouch Port Configuration define SNSK1 C ATMEL QTouch Library User Guide Page 53 Rev 8207G AT42 12 09 AMEL define SNS1 D define SNSK2 A define SNS2 B Channel Pin Configuration enable a key on channel 0 qt enable key CHANNEL 0 AKS GROUP 2 10u
97. igi 4qik isa 99 458 avSig2 qi example ibawSiga ak isa 99 Oo avrSgi qp example ibwSgi dk isa 99 A458 avr5g2 qi example Tbawsg2 4k isa w 0 ss avr5g3 qp example Tbawsg3 4k rsa HHT POENE aci gnu qi example xmegagi Su sxampl DMEGAi atk rsa 399 458 DXMEGA2 atk isa 99 458 ATMEL QTouch Library User Guide Page 69 Rev 8207G AT42 12 09 AMEL libXMEGA2_8qt_k_Ors a 3010 libXMEGA2 8qt k 2rs a 4742 IbXMEGA2 16qt k Orsa 3552 libXMEGA2_16qt_k_4rs a 271 5300 XMEGA1 avrxmega2g1 avrxmega3g1 avrxmega4g1 avrxmegadg1 avrxmega6g1 avrxmega7g1 XMEGA2 avrxmegadg2 avrxmega7g2 For XMEGA devices the AVR Studio IDE example project files and applications have been provided only for the ATxmega128A1 device For other XMEGA devices that are supported the project files along with the libraries linked to each project file and the example application needs to be modified accordingly 7 1 6 2 IAR compiler tool chain memory footprint for QTouch acquisition method libraries 22 iovigt Teak Oe BOT libvig2_16qt_k_Ors r90 3034 i _4rs 1 libv3g1_4qt_k_Ors r90 2494 v3g1_qt_example libv3g1 4qt k 1rs r90 3794 libv3g1 8qt_k_Ors r90 2484 ATMEL QTouch Library User Guide Page 70 Rev 8207G AT42 12 09 U 226 libvig4 16qt K 4rs r90 4292 3 AIMEL amp Novog e kammo 385 488 i 3 v3g4_qt_example e YO v3g6_qt_exa
98. ins The even pins of the port E are used as SNS pins and odd pins of the port E are used as SNSK pins SNSK1 SNS1 are on same port amp E g SNST G SNSK1 G on different ports amp SNS2 B SNSK2 D on SNSK2 SNS2 pins are on different same ports ports number of channels 12 Recommended configuration PGO PG1 PG2 PG3 PG6 PG7 PBO PDO to PB7 PD7 In this case channel 0 will be on PGO PG1 pins channel 1 will be on PG2 PG3 pins channel 3 will be on PG6 PG7 channel 4 will be on PBO PDO and so on up to channel 11 will be on PB7 PD7 pins The even pins of the port G are used as SNS pins and odd pins of the port G are used as SNSK pins 7 1 6 Sample applications and Memory requirements for QTouch acquisition method libraries The memory footprint of the QTouch acquisition method libraries is listed in this section The section also indicates if a sample project is supplied for the library variant 7 1 6 1 WinAVR GCC compiler tool chain memory footprint for QTouch acquisition method libraries 3572 avr5g qt example avr25g2 qt example libaw25g2 4qtk Irsa amp 99 5 4518 libew25g2 Sqt Kk 2rsa 98 S LEVIS gi ce Ure 3718 avr35g1_at_example Gl ee IE NE 4582 ibavra5g1 at k Ors a 3718 bavragi_4gr k Orsa 2082 av4gi qt example avr4g2 qi example ATMEL QTouch Library User Guide Page 68 Rev 8207G AT42 12 09 AIMEL G avSigi qi example ibewS
99. ion Wl section 0x800100 instead of 0x800200 start data 0x800200 10 1 Linker warning 10 1 1 SFRB Warning When using IAR workbench to integrate the touch libraries the linker would generate a warning indicating that there is a type conflict for the bit definitions of the PORT registers The QTouch libraries are built using a definition of the PORT registers which has a superset of all the bit definitions for the applicable devices in a device core group The IAR compiler uses a subset of this definition as applicable to the device selected which does not have all the bit fields defined for the selected device and this results in this warning being emitted These warnings should be ignored as they do not cause any malfunction or side effects The following code snippet shows the linker warnings Warning w6 Type conflict for external entry A DDRC in module burst 10 BC against external entry in module malin class struct union field base types do not match for field base class struct union field names do not match DDRC DDC7 vs DDRC Dummy In module burst 10 BC union Elements 3 Bytes 1 First seen in burst 10 BC unsigned char DDRC struct Elements 8 Bytes 1 First seen in main unsigned char DDRC BitO 1 disp 0 unsigned char DDRC_Bit1 1 disp 1 unsigned char DDRC BIG 1 disp 2 unsigned char DDRC BDG 1 disp 3 unsigned char DDRC Bit4
100. ion in a robust fashion A per sensor counter is incremented each time the sensor has exceeded its threshold and stayed there for a number of acquisitions When this counter reaches a preset limit the sensor is finally declared to be touched For example if the limit value is 10 then the device has to exceed its threshold and stay there for 10 acquisitions in succession without going below the threshold level before the sensor is declared to be touched If on any acquisition the signal is not seen to exceed the threshold level the counter is cleared and the process has to start from the beginning The user can configure the DI limit for a sensor 6 5 3 3 Adjacent Key Suppression In designs where the sensors are close together or set for high sensitivity multiple sensors might report detect simultaneously if touch is near them To allow applications to determine the intended single touch the touch library provides the user the ability to configure a certain number of sensors in an AKS group When a group of sensors are in the same AKS group then only the first strongest sensor will report detection The sensor reporting detection will continue to report detection even if another sensor s delta becomes stronger The sensor stays in detect until its delta falls below its detection threshold and then if any more sensors in the AS group are still in detect then the strongest will report detection So at any given time only one sensor from eac
101. irs 6 6 2 QMatrix acquisition method API constraints QMatrix acquisition method libraries are available for a set of AVRs and port combinations These port combinations have fixed port and pin assignments for X Ya Yb and SMP Discharge pin lines Some of the key constraints are The QMatrix acquisition method libraries internally use TIMER1 for the operation TIMER1 will not be available for critical sections of the code where the library is called But resources are available to the host application when the normal user s application is running In case of XMEGA devices the resources are used internal to the library and hence cannot be used by the host application o Timer Counter 1 on PORTC TCC1 o Analog Comparator on PORTA ACA o Event System Channeld EVSYS CHO The sensor channel number and the relation with X and Y lines strictly follows from the table provided in the section Table 1 A rotor slider sensor can be configured with 3 to 8 channels per rotor or slider depending on the requirement of the application subject to the total number of channels available in the library variant selected as listed below Number of X x Y Maximum Channels per ROTOR SLIDER channels 8 For example 16 channel library with 4X and 4Y lines supports maximum of 4 channels per Rotor Slider But a 16 channel with 8X and 2Y lines supports maximum of 8 channels per Rotor Slider If the lines of the Drive and Receive electrode X lines or the
102. is directory Library QTouch acquisition 8 bit MAtmel QTouch Libraries 3 2AVR Tiny files method libraries devices Mega XMegaQTouchNibrary files UC3 Atmel QTouch Libraries 3 2 32bit_AV R UC3 QTouch library_files QMatrix acquisition Atmel_QTouch_Libraries 3 2 AVR_Tiny_Mega_XM method libraries ega QMatrix library_files Atmel_QTouch_ Libraries 3 2 32bit_AV R UC3 QTouch example_projects QMatrix acquisition Atmel_QTouch_Libraries 3 2 AVR_Tiny_Mega_XM method libraries ega QMatrix example_projects 6 9 2 Integrating QTouch acquisition method libraries in your application Example QTouch acquisition 8 bit Armel QTouch Libraries 3 2AVR Tiny Projects method libraries devices Mega XMega QTouch example_projects The following steps illustrate how to add QTouch acquisition method support in your application 1 QTouch acquisition method library Variants are offered for IAR and AVR GCC tool chains First step is to select the compiler tool chain for which the libraries are required The list of supported compiler tool chains can be found in 7 1 2 2 Select the QTouch acquisition method library variant required for the device a There are specific library variants distributed for each microcontroller You would need the following parameters to identify the right library variant to be used in your application i The microcontroller to be used for the application li The number of channels you need for the application ii
103. itted cannot practically be avoided Rule states that implicit The library uses macros to combine symbol definitions conversion from Underlying to form a unique expanded symbol name and in this the long to unsigned long usage of unsigned qualifiers for numeric constants e g 98u causes name mangling This is the only occurrence of this error in the library This Rule says that a U suffix The library uses macros to combine symbol definitions shall be applied to all constants to form a unique expanded symbol name and in this the of unsigned type usage of unsigned qualifiers for numeric constants e g 98u causes name mangling This is the only occurrence of this error in the library Rule states that go to The library uses conditional jump instructions to reduce statement should not be used the code footprint at a few locations and this is localized to small snippets of code Hence this rule is not supported Rule states that In the definition There is one instance where the library breaks this rule of a function like macro each where two macro definitions are combined to form a instance of a parameter shall different symbol name Usage of parenthesis cannot be be enclosed in parenthesis used in this scenario Rule states that there shall be There is one instance in the library where this rule is at most one occurrence of the violated where the library concatenates two macro or preprocessor operator in definitions to arrive at a
104. l SNS pins m R terminated Pin 4 channel 4 on this port Pin5 channel 5 d Pine Channel 6 channel 7 Pin Z 2 Ben channel 8 fe Pin 1 EHI sensor4 channel 10 Port C Pin 2 I channel 11 All SNSK pins PINS aal 12 M terminated Pin4 sensor5 on this port Pin 5 channel 13 pee Pine Channel 14 C sensor6 channel 15 ane mm u Pin Z C sensor7 Port Pair two ye channel 8 Pin 1 channel 9 dL Port D Pina p oe channel 11 Pin 3 All SNS pins terminated Pin 4 channel 12 M on this port Pin 5 channel 13 Pine channel 14 Pin Z channel 15 Figure 7 channel numbering for QTouch acquisition method when the SNS and SNSK pins are connected to different ports ATMEL QTouch Library User Guide Page 26 Rev 8207G AT42 12 09 AMEL 6 5 1 1 2 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 used as the SNSK pins e he number of channels supported will be limited 4 channels for an 8 bit device and 16 channels for a 32 bit device e g UC3 e For e g for a 4 channel configuration where the SNS and SNSK pins are connected to Port B the port pins 0 amp 1 are used for channel 0 e The channel number is derived from the position of the pins used for SNS and SNSK lines for any channel channel number floor
105. lt RS gt rs a C D F m UJ m U UJ m UJ TO O D E F A B C D Atmega640 A B C D E F libavr5g3 lt CH gt qt k lt RS gt rs a A D Atmega644P libv3g3 CH at k Ors r90 libv3g3 CH at k RS rs r90 libavrbg3 CH at k Ors a libavrbg3 CH at k RS rs a libv3g3 CH at k Ors r90 libv3g3 CH at k RS rs r90 Atmega645 SERO libavrbg3 CH at k Ors a libavr5g3 lt CH gt at k lt RS gt rs a Atmega6450 libv3g3 CH at k Ors r90 libv3g3 CH gt k RS rs r90 libavrbg3 CH at k Ors a libavrbg3 CH qt k RS rs a libv3g3 CH at k Ors r90 libv3g3 CH at k RS rs r90 Atmega649 SERO libavr5g3 lt CH gt at k Ors a libavr5g3 lt CH gt at k lt RS gt rs a Atmega6490 libv3g3 CH at k Ors r90 libv3g3 CH gt k RS rs r90 libavrbg3 CH at k Ors a libavr5g3 lt CH gt at k lt RS gt rs a D libavr51g1 lt CH gt qt k lt RS gt rs a libv3g5 lt CH gt at k Ors r90 libv3g5 lt CH gt at k lt RS gt rs r90 libavr51g2 lt CH gt at k Ors a libavr51g2 CH at k RS rs a Atmega1280 Bee libv3g5 lt CH gt at k Ors r90 libv3g5 lt CH gt at k lt RS gt rs r90 Atmega128rfa1 libavr51g2 lt CH gt at k Ors a libavr51g2 CH at k RS rs a libv3g5 CH at k Ors r90 libv3g5 lt CH gt at k lt RS gt rs r90 Atmega1281 DER libavr51g2 CH at k Ors a libavr51g2 CH qt k RS rs a Atmega1284P libv3g5 lt CH gt at k Ors r90 libv3g5 CH at k RS rs r90 libavr51g2 lt
106. m libt88 8qm 4x 2y k Ors YL LO NIB r90 GCC libt88 8gm 4x 2y k Ors YL LO NIB a MENU x libt88 8qm 4x 2y k Ors YL HI NIB r90 GCC NE _8am_4x_2y_k_Ors_YL_HI_NIB a loll al 4 5 i Im 0 1 2 3 libt88 16qm 4x 4y k Ors YL LO NIB r90 libt88 16gm 4x 4y K Ors YL LO NIB a 0 1 2 3 libt88 16qm 4x 4y krs 2rs YL LO NIB r90 libt88 16qm 4x 4y krs 2rs YL LO NIB a m D A pi e libt88 16qm 4x 4y krs 4rs YL LO NIB r90 GCC libt88 16qm 4x 4y krs 4rs YL LO NIB a 16 8x2 libt88 16qm 8x 2y k Ors YL LO NIB r90 2220 GCC libt88 16qm 8x 2y k Ors YL LO NIB a 3254 libt88 16qm 8x 2y K Ors YL HI NIB a 3254 S E ke libt88_16gm_8x_2y_krs_2rs_YL_LO_NIB r9o 3500 8x2 4 5 ibt88_16qm_8x_2y krs 2rs YL HI NIB a 4340 KAMIL HE libt88 16gm 8x 2y rs 4rs YL LO NIB r90 3500 a i e libt88_16qm_8x_2y_k Ors YL HI NIB r90 2220 libt88 16gm 8x 2y rs 2rs YL LO NIB a 4340 libt88 16qm 8x 2y krs 2rs YL HI NIB r90 3500 ul libt88 16gm 8x 2y krs 4rs YL LO NIB a 4340 bd uli 4 5 libt88 16qm 8x 2y krs 4rs YL HI NIB r90 3500 libt88 16qm 8x 2y krs 4rs YL HI NIB a 4340 ATMEL QTouch Library User Guide Page 76 Rev 8207G AT42 12 09 AIMEL G 7 2 4 2 2 QMatrix acquisition method Library Variants for ATtiny167 Legend NC Number of channels Nx x NY Number of X x Y channels NRS Number of Rotors amp Sliders NC NX Y line Compiler Library to be used Code Data X pins memory Memory NY Y LINES ATtiny167 mmm 0 1 bud UE 4 5 libt167_8qm_4x_
107. measurement qt measure channels The host application periodically calls qt measure channels to make capacitive measurements check qt touch status check the global status variable qt touch status to see if any sensors are in detect and the angle or position of any enabled rotors or sliders Figure 6 Sequence of operations to add Touch capability ATMEL QTouch Library User Guide Page 24 Rev 8207G AT42 12 09 AMEL 6 5 1 Channel Numbering 6 5 1 1 Channel numbering when using QTouch acquisition method The choice of ports for routing the SNS and SNSK lines are determined by the availability of the QTouch acquisition method libraries which support the required port to be used to route SNS or SNSK lines There are two options provided for connecting the SNS and SNSK pins 1 The SNS and SNSK pins are connected to separate ports 2 The SNS and SNSK pins are connected to the same port 6 5 1 1 1 Channel numbering when routing SNS and SNSK pins to different ports Figure 7 illustrates a sample QTouch capacitive sensing solution which uses two ports on a device for routing the SNS and SNSK lines required When SNS and SNSK pins are connected to different ports the channel numbering follows the pin numbering in the ports selected e The channel numbers follow the pin numbers starting with the LSB pin O is channel O and pin 7 is channel 7 e When a library and corresponding device and ports
108. megaAVR and XMEGA device libraries and 8 16 32 for UC3 device libraries ROTOR SLIDER Rotor slider can be added to A library with rotor slider functionality already available the design if this symbol is needs to be selected if this macro is to be enabled defined DEBUG INTERFACE __ The debug interface code in This will enable the application to output QTouch the example application will measurement values to GPIO pins which can be used be enabled if this macro is by a USB bridge to view the output on Hawkeye or enabled QTouch Studio This feature is currently supported by EVK TS 2080A and QT600 boards DELAY CYCLES 1 2 3 4 5 10 25 50 Please refer to section 5 6 ATMEL QTouch Library User Guide Page 47 Rev 8207G AT42 12 09 avr4e1_qt_example Project Options am ial Include Directories Custom Compilation Options All files main atmega8515 c Linker Options td gnu33 DGT NUM CHANNELS 4 DSNSK A is Libraries B ad Memory Settings DSNS B DOT_DELAY_CYCLES 1 D_DEBUG_INTERFACE_ D_OTOUCH funsigned char funsigned bitfields fpack struct fshort enums Em External Tools Custom Options avr qcc make Use WindVR C Wwin4VR 2009031 3 bin avr gce exe C Swin amp vR 20090313 utilssbinsmake exe Figure 15 Specifying the QTouch acquisition method library configuration parameters in IAR IDE Options for node v1g1 qt example Category General Options
109. mended to disable PULL UP resistor on all port pins used for touch sensing on the device selected e g PUD bit in MCUCR SFIOR for a few of the tinyAVR and megaAVR devices Please refer to the Data sheet of the selected device The 16 bit timer in each device has been used for performing touch measurements periodically The datasheet for all the devices have to be checked to ensure that the correct timer peripheral and its registers are used file main c The interrupt vector macro may also change from device to device and this needs to be verified in the datasheet for the device used Check if the timer is configured correctly to support the measurement period needed e g 25msec or 50 msec The sample applications for the evaluation kits and supported devices illustrate the proper initialization sequence and usage of the timer resources file main c Please use this as a reference for your application design The host application must provide the current time to the library This information is passed to the library as an argument to the function qt measure sensors This is used for time based library operations such as drift compensation 6 9 3 Integrating QMatrix acquisition method libraries in your application Based on your application design needs the user needs to select the right library variant and the configuration to be used along with the variant This section illustrates the steps required to select the right QMatrix acqui
110. mp SNS2 C SNSK2 A are all on different ports number of Hecommended configuration PDO PBO PD1 PB1 PD7 PB7 channels 16 PCO PAO to PC7 PA7 In this case channel 0 will be on PDO PBO pins channel 1 will be on PD1 PB1 pins channel 8 will be on PCO PAO channel 9 will be on PC1 PA1 and so on up to channel 15 will be on PC7 PA7 pins SNSK1 SNS1 are on same port amp E g SNS1 K SNSK1 K amp SNS2 H SNSK2 H on same ports SNSK2 SNS2 pins are on same port Recommended configuration PKO PK1 PK2 PK3 PK6 PB7 number of channels 8 PHO PH1 to PH6 PH7 In this case channel O will be on PKO PK1 pins channel 1 will be on PK2 PK3 pins channel 4 will be on PHO PH1 channel 5 will be on PH2 PH3 and so on up to channel 7 will be on PH6 PH7 pins The even pins of the port are used as SNS pins and odd pins of the port are used as SNSK pins SNSK1 SNS1 are on different ports amp E g SNS1 H SNSK1 F on different ports amp SNS2 E SNSK2 E on SNSK2 SNS2 pins are on same port same ports number of channels 12 Recommended configuration PHO PFO PH1 PF1 PH7 PF7 PEO PE1 to PE6 PE7 In this case channel 0 will be on PHO PFO pins channel 1 will be on PH1 PF1 pins channel 8 will be on ATMEL QTouch Library User Guide Page 67 Rev 8207G AT42 12 09 AMEL PEO PE1 channel 9 will be on PE2 PE3 and so on up to channel 11 will be on PH6 PH7 p
111. mple Taa aas tos 8948 libuc3a_32qt_k_Ors r82 libuc3a_32qt_k_8rs r82 LH 9 89 L emo 310 3S5 Teas kae 28 M ATMEL QTouch Library User Guide Page 71 Rev 8207G AT42 12 09 AMEL C Rea 28 7 29 For XMEGA devices the IAR IDE example project files and applications have been provided only for the ATxmega128A1 device For other XMEGA devices that are supported the project files along with the libraries linked to each project file and the example application needs to be modified accordingly k Ors 220 libv5xmg 1_16qt_k_4rs r90 4243 u 7 ATMEL GTouch Library User Guide Page 72 Rev 8207G AT42 12 09 AIMEL 7 2 QMatrix acquisition method library variants 7 2 4 Introduction Variants of the ATMEL QTouch Library based on Matrix acquisition 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 7 2 2 Support for different compiler tool chains The QMatrix acquisition method libraries are supported for the following compiler tool chains IAR Compiler 5 30 6 IAR Embedded Workbench 5 3 6 927 GCC AVR Studio 4 18 build 673 WinAVR 20090313 7 2 3 QMatrix Acquisition method library naming conventions The libraries are named according the naming convention listed below Tool Chain Naming conven
112. nation of ports 7 1 5 2 Tips on pin assignments for the sensor design using one pair 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 for the sensor SNSK amp SNS pins are on different ports number of channels 4 SNSK amp SNS pins are on different ports number of channels 8 SNSK amp SNS pins are on different ports number of channels 16 when using UC3 device SNSK amp SNS pins are on the same port number of channels 2 SNSK amp SNS pins are on the same port number of channels 4 SNSK amp SNS pins are on the same port number of channels 8 Available only for UC3 devices if more than 4 channels are to be used on a single port For tinyAVH ATMEL QTouch Library User Guide Example Port configuration with pin assignments If the SNS C and SNSK B pins are on two different ports the user should mount the sensors onto the corresponding pins such as PCO PBO PC1 PB1 PC2 PB2 and PC3 PB3 If the SNS C and SNSK B pins are on two different ports the user should mount the sensors onto the corresponding pins such as PCO PBO PC1 PB1 PC2 PB2 In this case channel O will be on PCO PBO pins channel 1 will be on PC1 PB1 pins and so on up to channel 7 will be on PC7 PB7 pins If the SNS B and SNSK A pins are on two different ports the user should mount the sensors onto the corre
113. nippet below Disable pull ups for all pins MCUCR 1u lt lt PUD IMCUCR PUD tu Perform QTouch measurements qt measure sensors current time ms touch Enable pull ups for all pins MCUCR amp 1u lt lt PUD MCUCR PUD 0u For XMEGA devices the Pull up circuit for each individual GPIO port pins can be configured individually by writing to the PINnCTRL register of the ports being used 6 10 5 Adjusting the Stack size when using IAR IDE The example projects for IAR IDE the CSTACK and RSTACK values are configured to account for the requirements of the QTouch libraries and the included main c file which illustrates the usage of the touch API ATMEL QTouch Library User Guide Page 54 Rev 8207G AT42 12 09 AIMEL G e Adjust the CSTACK and RSTACK values appropriately based on additional software integrated or added to the examples Options for node v1g1 qt example Category Clc Compiler Assembler Custom Bulld Heap Configuration System MISRA C 2004 MISRA C 1998 al gt Data stack CSTACK Return address stack HSTACK Debugger Size bytes 0x30 Depth levels Ox10 AVR ONE Pi CCR ICE200 JTAGSICE JTAGICE mkII Dragon Simulator TU no no Third Party Driver oo Wp o Iw Initialize unused interrupt vectors with RETI instructions iv Enable bit definitions in IO Imclude files Figure 21 Modifying the stack size in IAR IDE 6 10 6 Optimiz
114. ny88 t88 qm 8ch 4x 2y k Ors Device Evaluation Kit 188 qm 8ch 4x 2y krs 2rs ATmega128HRFA1 m 128rfal qm example iar m 128rfal qm 64ch 8x By K Ors Ylow m 28rfal qm 64ch 8x By Krs drs Ylow m 28rfal qm 64ch 8x By Krs 8rs Ylow ATxmegai28A1 xmega qm example iar libvoxm 32qm 8x 4y k Ors YL LO NIB libv6exm 32qm 8x 4y Krs drs YL LO NIB Example projects provided for QMatrix acquisition method libraries for AVR Studio IDE with GCC toolchain ATtiny88 IBB qm example gnu 188 qm 8ch 4x 2y K Ors Ylow 188 qm 8ch 4x 2y krs 2rs Ylow ATmega88p m88p qm example gnu m88 qm 32ch 8x 4y K Ors Ylow m88 qm 32ch 8x 4y Krs drs Ylow ATmega16 m 16 qm example gnu m16 qm 16ch 8x 2y k Ors Yhigh ATMEL QTouch Library User Guide Page 49 Rev 8207G AT42 12 09 AMEL Pmt 6m 16ch 8x 2y krs 4rs Yhigh m1 64p q m 32ch 8x 4y krs 4rs Ylow mi65p qm 32ch 8x Ayo krs 4rs Ylow ATmega324P m324p qm example gnu m324p qm 64ch 8x 8y k Ors Ylow m324p qm 64ch 8x 8y krs 4rs Ylow m324p qm 64ch 8x 8y krs 8rs Ylow amm m8535 qm oo mne ma gnu m8535 gm_16ch_4x_4y_k_Ors_Yhigh c D m 16ch 4x 4y Krs drs Yhigh TS2080B qm example gnu IBB qm 8ch 4x 2y K Ors Device Evaluation Kit 188 qm 8ch 4x 2y krs 2rs ATmega128HRFA1 m 28rfal qm example gnu m 128rfal qm 64ch 8x By K Ors Ylow m 128rfal qm 64ch 8x By Krs 4rs Ylow m 128rfal qm 64ch 8x By Krs 8rs Ylow ATxmegai28A1 xmega_qm_example_gnu libvoxm 32qm 8x 4y k Ors YL LO NIB libv6exm 32qm 8x 4y Krs drs YL LO NIB 6
115. ompiling use Atmega32 when compiling AT90CAN32 A D libavr5g3 lt CH gt at k Ors a libavr5g3 CH gt k RS rs a G libv3g3 CH at k Ors r90 libv3g3 CH at k RS rs r90 Atmega164P libv3g3 CH at k Ors r90 libv3g3 CH at k RS rs r90 D libavrbg3 CH at k Ors a libavrbg3 CH at k RS rs a libavrbg3 CH at k Ors a libavr5g3 lt CH gt at k lt RS gt rs a Atmega168PA B C D libv3g3 CH at k Ors r90 libv3g3 lt CH gt at k lt RS gt rs r90 C libv3g3 CH at k Ors r90 libv3g3 CH qt k RS rs r90 Jat libavr5g3 lt CH gt at k Ors a libavr5g3 lt CH gt at k lt RS gt rs a Atmega16HVA A B libavrbg3 CH at k Ors a libavrbg3 CH at k RS rs a C D libv3g3 CH at k Ors r90 libv3g3 CH at k RS rs r90 F Atmega16A A D libavr5g2 lt CH gt qt k Ors a libavr5g2 lt CH gt qt k lt RS gt rs a use Atmega16 when compiling use Atmega16 when compiling C libv39g3 CH at k Ors r90 libv3g3 lt CH gt qt k lt RS gt rs r90 F AT9OCAN64 A D libavr5g3 lt CH gt aqt k Ors a libavr5g3 CH gt k RS rs a G Atmega165P A libv3g3 CH at k Ors r90 libv3g3 lt CH gt at k lt RS gt rs r90 D G GCC libavr5g3 lt CH gt at k Ors a libavrbg3 CH qt k RS rs a use Atmega168P when use Atmega168P when compiling compiling Atmega169P A B D E G C libv39g3 CH at k Ors r90 libv39g3 CH gt k RS rs r90 libavrbg3 CH at k Ors a libavrbg3 CH at k RS rs a Atmega16U4 U m uo UJ B C
116. on esee 36 6 9 2 1 E XODIDIG 9 moii TAE AT E OENE EDI CUN KORNI DALJE GORE ED IIR JA EE A ae DUC DoD DEM UMSO GNE D DIS 37 6 9 2 2 Checklist of items for integrating QTouch acquisition method libraries sss esse eee 39 6 9 5 Integrating QMatrix acquisition method libraries in your application eese 39 6 9 3 1 Resources used by QMatrix acquisition method libraries sss sese eee 4 G92 BRAIDS PR m 4 6 9 3 3 Checklist of items for integrating QMatrix Capacitive sensing libraries sss eee eee eee eee eee 42 6 9 4 CO onm cec COSE ICIS SEE STEPENE NES RA d ISI 43 6 9 4 1 Configuring the stack size Tor the applicatlOfi ise oae eerie e e Eae end Fear aad racc Hes a oerte eoo tal dne Eos Rud eEa abu dde 43 SAL MEE EXAMPLE ULUSM M 44 98109 MEME ELO 27 Tee 21 PrO CIS oenn a a E E 44 6 10 2 Example applications for QTouch acquisition method libraries cesse 44 6 10 2 1 Select the Ie DE conie irato a Goenapdc emite reat den Levi E d Debt DAcoiblon ti don katode Eto Pe E UHU 44 6 10 2 2 Changing the settings to match your device eee eee eee 46 at EO SS e DL RI I 46 6 10 2 3 Changing the library configuration parameters eee eee eee eee eee eee 47 6 10 2 4 Usine th example OI CCS c si cicacste cette ketona xgaictedinanseivanletosiien erae E koka got sea ed ioi iuri ga curas adi b
117. ors amp Sliders NC NX Y line Compiler Library to be used Code Data X pins memory Memory NY Y LINES ATMega128RFA1 m mem 0 1 1AB libm128rfa1_8gm_4x_2y_k_Ors_YL_LO_NIB r9O libm128rfa1_8qm_4x 2y k Ors YL LO NIB a 4x2 m libm128rfat 8qm 4x 2y K Ors YL HI NIB r90 libm128rfa1 8qm 4x 2y K Ors YL HI NIB a 4x2 2 0 1 libm128rfai 8qm 4x 2y krs 2rs YL LO NIB r 3468 90 lib128rfal 8qm 4x 2y krs 2rs YL LO NIB a 4402 4x2 2 4 5 IAR libm128rfa1_8qm_4x_2y_krs_2rs_YL_HI_NIB r9 3468 198 0 libm128rfat 8qm 4x 2y krs 2rs YL HI NIB a 4402 16 4x4 0 1 2 3 IAR Seed eae Nee ie dS 2146 242 MEA 16qm 4x 4y k Ors YL LO NIB a 2794 N em TI 16qm 4x 4y k Ors YL HI NIB r9 2146 GCC EIA _16qm_4x_4y k Ors YL HI NIB a 2794 Mi ui libm128rfai 16qm 4x 4y krs 2rs YL LO NIB 3488 r90 o _16qm_4x_4y_krs_2rs YL LO NIB 4406 Nw em a _16qm_4x_4y krs 2rs YL HI NIB r 3488 EM hall EEK 6qm_4x_4y_krs_2rs_YL_HI_NIB a 4406 Re aie libm128rfat 16qm 4x 4y krs 4rs YL LO NIB 3488 r90 i _16qm_4x_4y krs 4rs YL LO NIB 4406 IM tm ui 4 5 6 7 v IURIS 16qm 4x 4y krs drs YL HI NIB r 3488 m 90 GCC libm128rfai 16qm 4x 4y krs 4rs YL HI NIB a 4406 m TU 16qm 8x 2y k Ors YL LO NIB r9 2166 GCC MEA _16qm_8x_2y_k Ors YL LO NIB a_ 2786 Nay 4 5 libm128rfa1_16qm_8x_2y_k_ Ors YL HI NIB r9 2166 0 libm128rfai 16qm 8x 2y k Ors YL HI NIB a 2786 libm128rfai 16qm 8x 2y krs 2rs YL LO NIB 3508
118. ouch api h header file from the QTouch library in your application The touch api h can be found at in the release package 7 Initialize create and use the touch api s in your application a In your application create initialize and configure the sensors b configure the global thresholds for the library c providing timing for the QTouch libraries to operate i e the QTouch libraries do not use any timer resources of the microcontroller The Host application has to provide the required timing and also call the API s at the appropriate intervals to perform touch sense detect operations 8 General application notes a The QMatrix acquisition method libraries internally use TIMER1 for their operation b Ensure that there are no conflicts between the resources used by the touch library and the host application c Ensure that the stack size is adjusted to factor in the stack depth required for the operation of the touch libraries 6 9 3 1 Resources used by QMatrix acquisition method libraries The following additional resources are used by the QMatrix acquisition method libraries e One Analog Comparator One internal Timer Usually Timer1 depending on the availability on particular microcontroller e One ADC Multiplexer The critical section of the touch sensing library disables the use of ADC as conversion unit and enables the same ADC as a multiplexer but the user can use the ADC for conversion in rest of his application code In case of XM
119. ple projects to illustrate the usage of the touch APPs to add touch sensing to an application across various devices Sample applications are also provided for the following kits 1 TS2080A QTouch Technology evaluation Kit 2 TS2080B QMatrix Technology evaluation Kit Note Example projects must be built in the installed folder and if moved copied elsewhere then paths must be edited appropriately 6 10 1 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 library applicable for QTouch acquisition method libraries example project files and applications have been provided only for select devices which use these libraries 6 10 2 Example applications for QTouch acquisition method libraries 6 10 2 1 Selecting the right configuration Each example project for a device can support multiple configurations i e a keys only b with rotors and sliders c 16 channel etc The configuration sets determine the configuration options for using the library and also the right library variant to link with the project The configuration sets for IAR IDE are named according to the convention listed below Configuration set for IAR IDE Naming convention vP g Q lt CH gt qt_k_ lt RS gt rs ATMEL QTouch Library User Guide Page 44 Rev 8207G AT42 12 09 AIM
120. put Output Output from the library Use Data structure which holds the information about the library variant and its version information qt lib siginfo t structure definition for a QTouch acquisition method library variant Comment library version uint6 t Holds the library version information Bit fields se lib sig lword uintt6 t Bit fields Use B1 BO Library Type 00 QTouch acquisition method 01 QMatrix acquisition method 0 GCC 1 IAR B9 B3 Maximum number of channels supported by the library 0 Library supports only keys ATMEL QTouch Library User Guide Page 18 Rev 8207G AT42 12 09 HI ee supported by the library Reserved Port on which SNS Pins are configured first pair of SNS SNSK pins Port on which SNSK Pins are configured first pair of SNS SNSK pins Port on which SNS Pins are configured second pair of SNS SNSK pins Port on which SNSK pins are configured second pair of SNS SNSK pins Delay Cycle time The number of SNS SNSK port pairs used in the library qt lib siginfo t structure definitions for a QMatrix acquisition method library variant library version uint6 t Holds the library version information Bit fields Use J lib sig Iword uintt6 t Bit fields Use Library Type 00 QTouch acquisition method 01 QMatrix acquisition method 0 GCC 1
121. ragon cpususbl287 ATS ULSBT287 Kerr cpu usb162 ATIOLISB1B2 Third Party Driver Small Sustem rnnbinrahinn Figure 13 Changing the processor settings for the examples in IAR IDE ATMEL QTouch Library User Guide Page 46 Rev 8207G AT42 12 09 avr4e1_qt_example Project Options Active Configuration avrdgl_4tot_k_Ore m E dit Configurations General C Use External Makefile U Directories Output File Name avrdgl qt example elf r Output File Directory avr gt 4qt k rzs la Unsigned Chars funsigned char F alt4Susb320 Unsigned Bitfields Funsigned bitfields requency tA3usb355 Dp f RZ Pack Structure Members fpack struct Optirnization Short Enums Fshart enums Libraries EC SS Memory Settings x Create Hex rate Map File Generate List File Custom Option S aIr C Figure 14 Changing the processor settings for the examples in AVR Studio 4 6 10 2 3 Changing the library configuration parameters The configuration parameters required for the library are specified in the project options of the examples They are as listed below Symbol Constant name Range of values QTOUCH This macro has to be defined in order to use QTouch libraries SNS amp SNSK Section 7 1 5 1provides To be used if only single port pair is needed for the details on the range of values design allowed SNSK2 the range of values allowed QT NUM CHANNELS 4 8 16 for tinyAVR
122. rary User Guide Page 87 Rev 8207G AT42 12 09 1 GCC libavrxmega7_16gm_4x_4y krs 2rs YL LO NIB a 4534 16 4x4 4 0 1 2 3 libvoxm_16gm_4x_4y_krs_4rs_YL_LO_NIB r9O 3872 libavrxmega7 16qm 4x 4y krs 4rs YL LO NIB a 4534 libv6xm 16qm 8x 2y k Ors YL LO NIB r90 2496 16 8x2 0 1 libavrxmega7 16qm 8x 2y k Ors YL LO NIB a 16 libvoxm 16qm 8x 2y krs 2rs YL LO NIB r90 libavrxmega7 16qm 8x 2y krs 2rs YL LO NIB a 16 libvoxm 16qm 8x 2y krs 4rs YL LO NIB r90 libavrxmega7 16qm 8x 2y krs 4rs YL LO NIB a 32 94 19 onis en libv xm 32qm 8x 4y K Ors YL LO NIB r90 libavrxmega7 32qm 8x 4y k Ors YL LO NIB a 32 8x4 4 0 1 2 3 libv6xm 32qm 8x 4y krs 4rs YL LO NIB r90 3930 libavrxmega7 32qm 8x 4y krs 4rs YL LO NIB a 4566 7 2 4 3 Device configurations supported by the QMatrix acquisition method library variants This section lists the different configurations of X Y and SMP pins supported for each of the devices for which QMatrix Library variants are used The following sections list the various combinations possible Each table row lists the possible configuration of the Matrix combination the X Y and SMP line ports and the SMP pin position supported The corresponding configuration information will be required to be provided when using the library 7 2 4 3 1 Device configuration supported for ATtiny88 Device ATtiny88 NOTE AREF is PD6 and needs to be connected to GND Number of X x Y Y LINES PORT X PORT YA PORT YB PORT
123. ration supported for ATmegal64P eee 91 7 2 4 3 7 Device configuration supported for ATmega165P eeseeseessssessssseeeeeeeeeeee enn ee ee ee aet eene enne nnns 92 7 2 4 3 8 Device configuration supported for ATmega324P ATmega324PA sssssseeeeeeeeeeeeeeeeeeeeeennn nnn 95 7 2 4 3 Device configuration supported for ATmegal28RFA eee 96 7 2 4 3 10 Device configuration supported for ATXMEegaXXXXSA3 ee 97 7 2 4 3 11 Device configuration supported for ATxmega xxx A eee 97 MES SO DI L VTT 98 9 MISRA COMPLIANCE REPOR Tsis 99 9 1 WAT IS ON TRE D e 99 po TARGE PE NVIRONME N orrs a E R 99 D DEVIATIONS FROM MISRA C STANDARDS Jisuascucmis inicia o donijeta an aiaa OCEA ENEA a ESEE 99 9 3 1 OT OUCH acquisition method Drar ES aada ve E HEE eaer hn 99 9 3 2 OMairicaegusiuionmethod TDI GIES sissie E TS E S E E 100 10 KNOW NISU UN earar A EAS 100 IUT LINKER WARNING oeiee eee ae sats aa pa agentes E EEE E NE EE e aai EN EE a a nia 101 Pod REW a cc 101 11 REVISION HISTOR T 104 DISC LANE m HC 105 ATMEL QTouch Library User Guide Page 4 Rev 8207G AT42 12 09 AMEL 1 Preface This manual contains information that enables customers to implement capacitive touch solutions on ATMEL AVR microcontrollers using ATMEL QTouch libraries This guide is a functional description of the library software its programming interface and it also describes its use on the
124. re these channels and sensors and to initiate detection of a touch using capacitive measurements The QTouch libraries use minimal resources of the microcontroller The sampling of the sensors is controlled by the QTouch library while the sampling period is controlled by the application possibly using timers sleep periods varying the CPU clock external events like interrupts or communications etc ATMEL QTouch Library User Guide Page 8 Rev 8207G AT42 12 09 AMEL 5 2 Acquisition Methods There are two methods available for touch acquisition namely 1 QTouch acquisition method 2 QMatrix acquisition method There are libraries available for AVR microcontrollers for each acquisition method 5 2 1 QTouch acquisition method The QTouch acquisition method charges an electrode of unknown capacitance to a known potential The resulting charge is transferred into a measurement capacitor Cs The cycle is repeated until the voltage across Cs reaches a voltage The signal level is the number of charge transfer cycles it took to reach the voltage Placing a finger on the touch surface introduces external capacitance that increases the amount of charge transferred each cycle reducing the total number of cycles required for Cs to reach the voltage When the signal level number of cycles goes below the present threshold then the sensor is reported as in detect Field coupling ban xx Dielectric front panal sample capa
125. release of QTouch library users guide Ver2 0 Sep 2009 Re structured user guide with new and expanded sections Ver 3 0 Nov 2009 6 3 6 9 6 10 Updated API changes Ver 3 1 7 10 Updated new libraries and device support information Updated debug interface information supported by the QTouch libraries Updated known issues table Dec 2009 6 10 4 7 1 2 Added section about configuring unused pins in user application Ver 3 2 7 1 5 7 1 6 10 Added more information to some sections to clear ambiguity 1 2 4 2 2 Updated Memory footprint information for IAR and GCC compiled 7 2 4 3 7 QTouch libraries 7 2 4 3 2 Updated known issues table TAR Added the device support port combinations memory 7 2 4 3 7 requirements QMatrix IAR and GCC libraries to support ATmega325P ATmega645 and ATtiny167 Modified port combinations for the 165P for QMatrix libraries Few Port combinations added in case of ATmega88 libraries ATMEL QTouch Library User Guide Page 104 Rev 8207G ATA42 12 09 MEL pO Headquarters International ATMEL Corporation ATMEL Asia ATMEL Europe ATMEL Japan 2325 Orchard Parkway Unit 1 5 amp 16 19 F Le Krebs 9F Tonetsu Shinkawa Bldg San Jose CA 95131 BEA Tower Millennium 8 Rue Jean Pierre 1 24 8 Shinkawa USA City 5 Timbaud Chuo ku Tokyo 104 0033 Tel 1 408 441 0311 BP 309 Japan 418 Kwun Tong Road Kwun Tong Kowloon Hong Kong Tel 852 2245 6100 Fax 852 2722 1369 Fax 1 408 487 2600 7805
126. rs must be configured using qt enable key qt enable rotor or qt enable slider before calling this function e This functions initializes all the configured sensors performs calibration 6 4 qt measure sensors This function performs a capacitive measurement on all enabled sensors The measured signals for each sensor are then processed to check for user touches releases changes in rotor angle and changes in slider position unit8 t dL measure sensors uint16 current time ms Arguments Type Comment The current time in milliseconds Comment Value uint8 t Returns the status of the Library as a combination of the following bit fields Return value Bit Comments No activity detected on any of the sensors At least one sensor is in detect At least one sensor has changed ON OFF state since the last call to qt measure sensor At least one rotor slider has changed position since the last call to qt measure sensors QTLIB CHANNEL REF CHANGE At least one reference value has changed since last call to qt measure sensors NOTE e All sensors must be configured using qt enable key or qt enable rotor or qt enable slider and initialized by calling qt init sensing before calling this function 6 4 7 qt calibrate sensing This function forces a recalibration of all enabled sensors void qt calibrate sensing void Arguments Type Comment Void lb NOTE e Recalibration may be u
127. s that hold sensor status settings and diagnostics information 6 3 1 gt_touch_status_t structure gt_touch_status_t Input Output Output from the Library Use Holds the status On Off of the sensors and the linear and angular positions of sliders and rotors respectively sensor_states For Sensor the sensor states Bit n state of nth sensor Bit Value 0 indicates the sensor is not in detect Bit Value 1 indicates the sensor is in detect rotor slider values Rotors angles or slider positions if rotors and sliders are used These values are valid when sensor states shows that the corresponding rotor or slider is in detect 6 3 2 qt touch lib config data t Structure qt touch lib config data t Input Output Input to the library Use Configuration data for the library Fields amp Type Comment Comment O qt recal threshold recal threshold t Sensor recalibration threshold Default RECAL 50 recalibration threshold ATMEL QTouch Library User Guide Page 16 Rev 8207G AT42 12 09 AIMEL G Ps 50 percent of detection threshold at di Sensor detect integration DI limit Default value 4 qt drift hold time uint8 t Sensor drift hold time in units of 200 ms Default value 20 20 x 200 ms 4s that is hold off drifting for 4 seconds after leaving detect qt max on duration uint8 t Sensor maximum on duration in units of 200 ms For example 150 recalibrate after 30s 150 x 200 ms
128. seful if for example it is desired to globally recalibrate all sensors on a change in application operating mode e This function must be called only when the sensors have been configured and initialized ATMEL QTouch Library User Guide Page 22 Rev 8207G AT42 12 09 AMEL 6 4 8 qt_reset_sensing This function disables all sensors and resets all configuration settings for example qt_di to their default values void qt_reset_sensing void Arguments Type Comment Void J lb NOTE e his may be useful if it is desired to dynamically reconfigure sensing After calling this function any required sensors must be re enabled and qt init sensing must be called before qt measure sensors is called again 6 4 9 qt get sensor delta This function returns the delta value for a given channel IHI G t qt get sensor delta uint8 t sensor number Arguments Type Comment sensor id for which the delta is required Return type intl6 t The delta value of the sensor specified NOTE e All sensors must be configured using qt enable key or qt enable rotor or qt enable slider and initialized by calling qt init sensing before calling this function 6 4 10 qt get library sig This function is used to retrieve the library version and signature from the library void qt get library sig qt lib siginfo t lib sig ptr Arguments Types Commet lib sig ptr qt li
129. sition method library variant and configuration for your application For your design you would need the following information to select the correct library variant a Device to be used for the design b Maximum number of channels required for the design c Number of X lines to be used in the design a he ports on which your design permits to have the X lines d Number of Y lines to be used in the design a he ports on which your design permits to have the Y lines b Can you have the Y line pins routed to lower pin numbers pins O to 3 or higher pin numbers pins 4 to 7 on the selected port e Do you need support for Rotors and or Sliders in your design a If yes How many f Which compiler platform you intend to use to integrate the libraries ATMEL QTouch Library User Guide Page 39 Rev 8207G AT42 12 09 AMEL Follow the steps listed below to arrive at the right library variant 1 Select the device from the list of supported devices listed in 7 2 4 1 2 Select the right library variant for the device selected in step 1 by using the tables listed in section 7 2 4 2 Each variant supports a specific number of channels Supports a specific configuration of X x Y matrix pins eg 4 X pins x 2 Y pins Can support the Y lines on specific pin numbers has support for Rotor Slider either supported or not support is available for IAR and or GCC compiler tool chain support for specific number of rotors sliders g supports from
130. sponding pins such as PBO PAO PB1 PA1 PB2 PA2 In this case channel O will be on PBO PAO pins channel 1 will be on PB1 PA1 pins and so on up to channel 15 will be on PB15 PA15 pins An exception to this is the case of configuring touch channels for QTouch which would have the SNS and SNSK pins on the same port When using the 4 8 16 channel libraries 16 channel only in the case of UC3 the channels effectively available are reduced by half to 2 4 and 8 respectively If the use of SNS A and SNSK A pins are on the same port the user should always have the configuration PAO PA1 amp PA2 PA3 In this case channel O will be on PAO PA1 pins channel 1 will be on PA2 PA3 pins The even pins of the port are used as SNS pins and odd pins of the port are used as SNSK pins If the use of SNS A and SNSK A pins are on the same port the user should always have the configuration PAO PA1 PA2 PA3 PA4 PA5 amp PA6 PA7 In this case channel 0 will be on PAO PA1 pins channel 1 will be on PA2 PA3 pins and so on up to channel 4 will be on PA6 PA7 pins The even pins of the port are used as SNS pins and odd pins of the port are used as SNSK pins This configuration is available only for UC3 library variants In the use of SNS A and SNSK A pins are on the same port the user should always have the configuration PAO PA1 PA2 PAS PA4 PA5 amp so on In this case channel O will be on PA
131. steresis Arguments Type Comment CC Specifies the channel number to be configured for use as a key Specifies the aks group associated with the sensor being configured as key detect threshold threshold t Specifies the detect threshold for the sensor detect hysteresis hysteresis t Specifies the detection hysteresis for the sensor 6 4 3 qt enable rotor This function is used to configure a set of channels as a rotor void qt enable rotor channel t from channel channel t to channel aks group t aks group threshold t detect threshold hysterisis t detect hysterisis resoulution t angle resolution uinta t angle hysterisis Arguments Type Comment _ ___ _ S NOTE e A Rotor sensor requires contiguous channel numbers ATMEL QTouch Library User Guide Page 20 Rev 8207G AT42 12 09 AIMEL G e 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 O the second will use rotor slider values 1 and so on The reported rotor value is valid when the rotor is reported as being in detect e Incase of QMatrix acquisition method library the channels from channel and to channel can be between 3 to 8 channel numbers apart i e can support 3 to 8 channel rotors e Incase of QTouch acquisition method library the channels from channel and to channel can only be 3 channels apart i
132. supported for single port pair SNS and SNSK pin configurations This section lists the possible single port pair combinations supported for the various touch library variants This section can be used as a reference when using the e 4 amp 8 channels libraries for tinyAVR megaAVR and XMEGA devices e 8 16 and 32 channel libraries for UC3 devices NOTE Port pair convention followed in the tables below MN M Port used for SNSK N Port used for SNS If a device supports a number of ports not all combination of ports will be supported to be used as SNS and SNSK ports The valid SNSK SNS port combinations for libraries supporting a subset of the ports A B C D E F amp Gare given in Table 9 Table 9 Valid single port combinations for ports A B C D E F amp G supported by libraries SK SNS A B C D E F G A AA B AB BB C AC BC CC D AD BD CD E AE BE CE F AF BF CF G AG BG CG DG EG FG GG III Not supported SNSK PORT SNS PORT Supported combination of ports The valid SNSK SNS port combinations for libraries supporting a subset of the ports D E F J H amp K are given in Table 10 Table 10 Valid single port combinations for ports D E F J H amp K supported by libraries SK NS D DD DE DF DJ DH DK EK FK JK HK KK CD Arc H H C ATMEL GTouch Library User Guide Page 64 Rev 8207G AT42 12 09 AIMEL G III Not supported SNSK PORT SNS PORT Supported combi
133. 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 e TS2080A B data sheet e Release Notes for ATMEL QTouch Software libraries 3 2 e Capacitive touch sensor design guide ATMEL Document reference 10620E AT42 09 09 http www atmel com dyn resources prod_ documents doc10620 pdf If you need Assistance For assistance with OTouch capacitive sensing software libraries and related issues contact your local ATMEL sales representative directly or send an email to avr atmel com ATMEL GTouch Library User Guide Page 5 Rev 8207G AT42 12 09 AMEL 2 Introduction ATMEL s QTouch Library is a royalty free software library available for GCC and IAR compiler tool chains for developing touch applications on standard AVR 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 or to develop standalone touch sensing solutions which interface with other host or control devices Features of ATMEL s QTouch Library include Capacitive touch sensing using patented charge transfer signal acquisition for robust sensing Support for a wide range of 8 and 32 bit AVRs Support both QTouc
134. ted to the order in which the sensors are enabled This is independent of the acquisition method QMatrix or QTouch acquisition method libraries For example consider this code snippet enable slider qt enable slider CHANNEL 0 CHANNEL 2 AKS GROUP 1 16 HYST 6 25 RES 8 BIT 0 enable rotor qt enable rotor CHANNEL 3 CHANNEL 5 AKS GROUP 1 16 HYST 6 25 HER 8 BIT 0 enable keys qt enable key CHANNEL 6 AKS GROUP 2 10 HYST 6 25 qt enable key CHANNEL 7 AKS GROUP 2 10 HYST 6 25 In the case above the slider on channels O to 2 will be sensor 0 the rotor on channels 3 to 5 is sensor 1 and the keys on channels 6 and 7 are sensor numbers 3 and 4 respectively When the touch status is reported or queried the corresponding sensor positions and status indicate the touch status For example the slider is in detect if gt measure data qt touch status sensor states bit position O is set Similarly the rotor on channels 3 to 5 is sensor 1 and the keys on channels 6 and 7 are sensors 2 and 3 respectively However the code could be re arranged as follows to give a different sensor numbering enable rotor qt enable rotor CHANNEL 3 CHANNEL 5 NO AKS GROUP 16 HYST 6 25 HES 8 BIT 0 enable keys qt enable key CHANNEL 6 AKS GROUP 2 10 HYST 6 25 qt enable key CHANNEL 7 AKS GROUP 2 10 HYST 6 25 enable slider ATMEL QTouch Library User Guide Page 30 Rev 8207G AT42 12 0
135. the configuration defined in steps above d Provide timing for the QTouch libraries to operate i e the QTouch libraries do not use any timer resources of the microcontroller The Host application has to provide the required timing and also call the API s at the appropriate intervals to perform touch sense detect operations e NOTE The example applications provided with the libraries illustrate the usage for the evaluation kits supported by the library Please refer to the source files for reference 5 General application notes e The clock host application and other peripherals needed by the host application needs to be initialized e Ensure that there are no conflicts between the resources used by the touch library and the host application e Ensure that the stack size for your application is adjusted to factor in the stack depth required for the operation of the touch libraries 6 9 2 1 Example The example below will explain in detail the steps to follow for library selection ATMEL QTouch Library User Guide Page 37 Rev 8207G AT42 12 09 AMEL Criteria Selection Nots Microcontroller ATMega1281 p IDE and compiler tool chain used AVR STUDIO IDE and GNU compiler The GCC compiled variant of the libraries for the device selected needs to be used Number of Keys required for the Each key requires 1 QTouch application acquisition channel 3 Rotors and sliders required Yes P
136. the pointer variable pqt measure data qt touch lib measure data t pqt measure data amp aqt measure data ATMEL QTouch Library User Guide Page 57 Rev 8207G AT42 12 09 AMEL 7 Library Variants 7 1 QTouch Acquisition method library variants 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 7 1 2 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 Version IAR Compiler 5 30 6 IAR Embedded Workbench 5 3 6 927 GCC AVRStudio 4 18 build 673 IAR32 Compiler 3 20A W32 WinAVR 20090313 GCC AVR GCC GNU Tool Chain avr32 gnu toolchain 2 1 0 7 1 3 QTouch Acquisition method library naming conventions The libraries are named according the convention listed below 7 1 3 1 Naming convention for libraries to be used with WinAVR GCC tool chain lib lt avrP gt g lt Q gt CH at K RS rs a name values avrP avr25 VersionP of the core AVR device supported by this library variant for tinyAVR and avr 35 megaAVR devices Also supports XMEGA and UC3 cores avr 4 avr 51 avr 5 avrxmega2 avrxmega3 avr
137. tion GCC Tool Chain lib lt D gt _ lt NC gt qm_ lt NX gt x_ lt NY gt y_ lt CFG gt _ lt NRS gt rs_ lt Y_LINES gt a IAR EWAR lib lt D gt _ lt NC gt qm_ lt NX gt x_ lt NY gt y_ lt CFG gt _ lt NRS gt rs_ lt Y LINES gt r90 Field Possible values Comments name Common for IAR amp GCC Indicates the device core group name in short form t88 t167 For XMEGA Devices Core groups are taken which follows m164p As below for both GCC and IAR m324p m128rfa1 Supported XMEGA Devices m8535 ATxmega64A1 Specific to IAR ATxmega128A1 m16a ATxmega64A3 m88pa ATxmegai28A3 m324pa ATxmegal1924A3 v3xm ATxmega64A3 ATxmega256A3 v4xm ATxmega64A1 ATxmega256A3B vdxm ATxmegai28A3 ATxmega1924A3 ATxmega2564A3 ATxmega256A3B v6xm ATxmega128A1 v3g3 ATmegat165P ATMEL QTouch Library User Guide Page 73 Rev 8207G AT42 12 09 AMEL ni ATmega325P ATmega645 Specific to GCC m16 m88p avrxmega4 ATxmega64A3 avrxmega5 ATxmega64A1 avrxmega6 ATxmega128A3 ATxmega1924A3 ATxmega256A3 ATxmega256A3B avrxmega7 ATxmega128A1 avr5g3 ATmegat165P ATmega325P ATmega645 8 16 32 64 Indicates the maximum number of channels that the library supports 4 Indicates the number of X Lines that the library needs for supporting the listed number of channels 2 Indicates the number of Y Lines that the library needs for supporting the listed number of channels k k library variant supports only keys kr krs library variant supports keys
138. touch sensing using QMatrix acquisition Rev 8207G AT42 12 09 AMEL SMP_BIT See device SMP Pin used for touch sensing using QMatrix configurations acquisition supported in section 7 2 4 3 ROTOR SLIDER Symbol defined if Needs to be added in case user needs to Rotor and or slider configure ROTOR SLIDER is required Needs to be removed for ALL KEYS configuration DELAY CYCLES 1 2 3 4 5 10 25 The Dwell Cycle time used for the Qmatrix 50 acquisition method DEBUG INTERFACE _ Specify this if debug data should be output to be viewed with QTouch Studio on a PC connected See section 6 10 7 This feature is currently supported by EVK TS 2080B and QT600 boards The above parameters can be customized in the project configuration settings Unu Factory Settings General Options Multi file Compilation loc cm C C Compiler npiscard Unused Publ Assembler Custom Build Language Code Optimizations Output List Preprocessor CA Build Actions Linker Debugger Ignore standard include directories TODLEIT DIRSMNES l AVR ONE HERIT ECLES CUR ICE200 Eis JTAGICE su NUN NIneclude JTAGICE mkII Dragon Simulator Third Party Driver ee mi Additional include directories one per line Freinclude file Defined symbols one per line I Preprocessor output to file WQT_NUM_CHANNELS 32 Preserve comment JOT Max NUM ROTORS SLI li ung cod THI tatoo PORT _s E Cancel
139. ud UU DU UU EERE Eus aua 48 6 10 35 Example applications for QMatrix acquisition method libraries essen 49 6 10 3 1 Selects The Ti S E COMI Te caen hue QUE oa e EORR EHE VO FUR mE a Fc Ind Pew ER joj KE ep EQ EM Rap us Rod ie kak 50 6 10 3 2 Changing the library configuration parameters sese eee eee eee eee 51 6 10 3 3 Usine the example eee ee 26 50 at siecsunaucedseasSoudhedSoenshuauvesaeannshebwinoivausatcie sees ednoendbanvabeacaldouusivalesiessesnmeaiadess 53 6 10 4 Allocating unused Port Pins for User Application sss eene eene nnns 53 6 10 4 1 Disabling and Enabling of Pull up for AVR devices sese 54 6 10 5 Adjusting the Stack size when using TAR IDE 54 OLE OJO TT A 2 rr E em TR eee eT ee eee ee eee 55 6 10 7 Debug Support in Example applications xxxxx xxxxxxxx xxxxxrrxs se xrexs ee0 2220000002220000 56 6 10 7 1 Debug Support in the sample applications for EVK2080 and QT600 boards sees sese esse eee 56 6 10 7 2 How to turn on the debug Opus see kes e co ve casariasucsineciacscaniaidantanscessnanadaonmnasduatniues NI dedo ME ME RUE U bM DU VOR RO a REF ceases 56 6 10 7 3 Debug Interface if USB Bridge board is not available sese 57 7 LIBRARY VARIAN ES 58 7 1 QTOUCH ACQUISITION METHOD LIBRARY Y ARIANTSR neret nnnereehtene ses trns sese ee seen tense etre seen 58 7 1 1 M
140. xmega4 avrxmegad avrxmega6 avrxmega7 ATMEL QTouch Library User Guide Page 58 Rev 8207G AT42 12 09 AIMEL SEES s Tal eer uc3b Q 1to6 group Q of the core AVR device supported by this library variant 4 8 16 32 Total number of channels supported by each library RS 1 2 4 8 Total number of rotors sliders supported for the respective channel counts mentioned in previous row For example the library variant libavr25g1_16qt_k_4rs a supports the following configuration e Device tinyAVR or megaAVR device belonging to core group avr25 e Belongs to a set of devices of group 1 supported by this library e Support a maximum of 16 channels e Supports a maximum of up to 4 rotors sliders 7 1 3 2 Naming convention for libraries to be used with IAR EWAR The libraries are named according the naming convention listed below lib lt vP gt g lt Q gt _ lt CH gt qt_k_ lt RS gt rs r90 name values vP v1 VersionP of the core AVR device supported by this library variant variant for tinyAVR and v3 megaAVR devices Also supports Xmega and UC3 cores v3xmsf v3xm v4xm voxm v6xm uc3a uc3b GroupQ of the core AVR device supported by this library variant 4 8 16 32 Total number of channels supported by each library C H HS 1 2 4 8 Total number of rotors sliders supported for the respective channel counts mentioned in previous row For example the library variant libv3g5 4qt k 1rs r90 supports the following

Download Pdf Manuals

image

Related Search

Related Contents

HotM h1-4v10ol [更新済み]  C06 User Manual T  Lumintrek TrailBlazer LED Bicycle Light User Manual Model: TB-1000  Telecamera HD 720p Real Time Zoom Ottico 10x  Installation & Service Manual  Samsung GH17LS User's Manual  gebruiksaanwijzing mode d` emploi manual gebrauchsanweisung  電気システム工学科  lignes - VISES  Solaris 10 807 Versionshinweise  

Copyright © All rights reserved.
Failed to retrieve file