Atmel QTouch Library User Guide
Atmel QTouch Library User Guide Atmel QTouch Library User Guide
definition is not required.QT_NUM_CHANNELS 4, 8, 12, 16 for tinyAVR,megaAVR and XMEGA devicelibraries and 8, 16, 32 for UC3device libraries._ROTOR_SLIDER_Rotor / slider can be added tothe design, if this macro isenabled.A library with rotor / sliderfunctionality alreadyavailable needs to beselected if this macro is tobe enabled.QT_DELAY_CYCLES 1 to 255 Please refer to section5.6.8._POWER_OPTIMIZATION_(Required only for ATtiny and ATmegalibraries. ATxmega and UC3 libraries bydefault optimized for power without anylimitations)0 or 1 Used to reduce the powerconsumed by the library.When power optimization isenabled the unused pins,within a port used forQTouch, may not be usablefor interrupt drivenapplications. Spreadspectrum noise reduction isalso disabled when poweroptimization is enabled._TOUCH_ARM_ To be defined when usingATSAM librariesQTOUCH_STUDIO_MASKSThis macro needs to be definedif QTouch Studio PinConfigurator Wizard.is used togenerate the SNS and SNSKmasks._STATIC_PORT_PIN_CONF_This macro needs to be definedonly in case of 4 and 8 channellibraries with interportconfiguration and pinconfigurability.For ATSAM libraries only.Please refer to section 5.8.1Please refer to section 5.8.14) Using QTouch API’s in your application to add touch functionalitya. The clock, host application and other peripherals needed by the host applicationneeds 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 5.6.5.2,5.6.5.3 and 5.6.5.4.c. The channel configuration parameters need to be set by calling theqt_set_parameters() ( see section 5.6.5.1.d. Once the sensors are configured, qt_init_sensing() has to be called to trigger theinitialization of the sensors with the configuration defined in steps above.d. Provide timing for the QTouch libraries to operate. i,e the QTouch libraries do notuse any timer resources of the microcontroller. The Host application has toprovide the required timing and also call the API’s at the appropriate intervals toperform touch sense detect operations.NOTE: The ATSAM example applications provided with the libraries illustrate theusage for the evaluation kits supported by the library. Please refer to the main.c filesfor reference.5) Adding the necessary source filesThe following files are to be added along with the touch library and user applicationbefore compilation:528207K-AT42-09/11
• ATtiny, ATmega devices - touch_api.h, touch_qt_config.h andqt_asm_tiny_mega.S• ATxmega devices - touch_api.h, touch_qt_config.h and qt_asm_xmega.S• UC3 devices – touch_api.h• ATSAM devices - touch_api.h and touch_qt_config.h6) General application notes• The clock, host application and other peripherals needed by the host applicationneeds to be initialized.• Ensure that there are no conflicts between the resources used by the touchlibrary and the host application.• Ensure that the stack size for your application is adjusted to factor in the stackdepth required for the operation of the touch libraries.Example for 8bit AVRThe example below will explain in detail the steps to follow for library selection.Criteria Selection NotesMicrocontrollerATMega1280IDE and compiler tool chainAVR STUDIO ® The GCC compiled variant of the libraries for theIDEuseddevice selected needs to be used.and GNU compilerNumber of Keys required 3 Each key requires 1 QTouch acquisition channelfor the applicationRotors and sliders required YesNumber of Rotors and 3 Each rotor / slider will require 3 channels.Sliders requiredNumber of Channelsrequired for the application( should be the sum of allchannels required for all thekeys ,rotors and slidersused in the design )12 3 Keys + ( 3 rotors x 3 channels per rotor/slider ) 12 channelsCharge cycle time requiredfor the design1 cycle Assuming the device is configured with a clockfrequency of 4MhzNumber of ports needed 3 ports This is determined based on the number ofchannels required and the routing required for thechannels SNS and SNSK pins to the portsFor this design, 24 pins are required and we need3 ports to support the sensors.Choice of ports availablefor the designSNS/SNSKPair1portsSNS/SNSKPair 2portsSNS1 Port: ASNSK1 Port: ASNS2 Port: BSNSK2 Port: CThe choice of ports for the port pairs is limited andcan be found in the section 5.7.1.5Is there a need for reducedpower consumption (andreduced execution time)?_POWER_OPTIMIZATION_ = 1Enabling _POWER_OPTIMIZATION_ will lead toa 40% reduction in power consumed by thelibrary, but at the expense of reduced externalnoise immunity. When power optimization isenabled, the unused pins within a port used forQTouch, may not be usable for interrupt drivenapplications. This option is available only forATtiny and ATmega devices.53
- Page 1: Atmel QTouch LibraryUser GuideSuppo
- Page 4: 5.6.11.6.1 Debug Support in the sam
- Page 7 and 8: 6.3.16.21 touch_info_t ............
- Page 12 and 13: • ARM: refers to a device in the
- Page 14 and 15: Libraries for AVR microcontrollers
- Page 16 and 17: QMatrix charge transfer is labeled
- Page 18 and 19: Maximum ON DurationIf an object uni
- Page 20 and 21: Setting Variable name Data Type Uni
- Page 22 and 23: Guard ChannelGuard channel in Qtouc
- Page 24 and 25: 7 AKS groups are supported by the l
- Page 26 and 27: Data structuresThis section lists t
- Page 28 and 29: The signal gain for each sensor is
- Page 30 and 31: • This function can be called any
- Page 32 and 33: unit16_t qt_measure_sensors( uint16
- Page 34 and 35: Channel NumberingChannel numbering
- Page 36 and 37: qt_reset_sensing()qt_enable_xxx()qt
- Page 38 and 39: Port AAll SNSK pinsterminatedon thi
- Page 40 and 41: Example:Pins A0 ,A3 and A5 of PORT
- Page 42 and 43: Channel 47 N/A N/A N/A N/A N/A X7Y5
- Page 44 and 45: channel 0channel 1channel 2channel
- Page 46 and 47: Disabling and Enabling of Pull-up f
- Page 48 and 49: ‣ Recommended threshold should be
- Page 50 and 51: QMatrix acquisitionmethod libraries
- Page 54 and 55: SNS1 and SNSK1 pins usethe same por
- Page 56 and 57: • It is recommended to disable PU
- Page 58 and 59: Table 4 :List of configurable param
- Page 60 and 61: Number ofchannels requiredfor the a
- Page 62 and 63: 2. The above definitions should be
- Page 64 and 65: NUM_Y_LINES_ROTOR_SLIDER_QT_MAX_NUM
- Page 66 and 67: has Four Comparators (AC0A , AC1A ,
- Page 68 and 69: Note: When using the IAR IDE / comp
- Page 70 and 71: Figure 5-11: Selecting the right co
- Page 72 and 73: SNS1 - SNSK1 & SNS2 -SNSK2QT_NUM_CH
- Page 74 and 75: Selecting the right configurationTh
- Page 76 and 77: Figure 5-20 : Specifying QMatrix ac
- Page 78 and 79: Debug Support in Example applicatio
- Page 80 and 81: Support for different compiler tool
- Page 82 and 83: Maximum number of rotor / sliders s
- Page 84 and 85: Tips on pin assignments for the sen
- Page 86 and 87: ATtiny88)v1g1s2(ATtiny461,ATmega16a
- Page 88 and 89: X0,X1,X2,X3 are on PB0,PB1,PB2,PB3N
- Page 90 and 91: 1. The channel numbers are allocate
- Page 92 and 93: SNSK_array[1][1]=0x00; (SNSK odd ma
- Page 94 and 95: SNSK_array[1][0]=0x14; (SNSK even m
- Page 96 and 97: Figure 5-28: New Design Sensors in
- Page 98 and 99: Figure 5-31: Selecting the MCU for
- Page 100 and 101: Figure 5-34: Selecting the SNS and
• ATtiny, ATmega devices - touch_api.h, touch_qt_config.h andqt_asm_tiny_mega.S• ATxmega devices - touch_api.h, touch_qt_config.h and qt_asm_xmega.S• UC3 devices – touch_api.h• ATSAM devices - touch_api.h and touch_qt_config.h6) General application notes• The clock, host application and other peripherals needed by the host applicationneeds to be initialized.• Ensure that there are no conflicts between the resources used by the touchlibrary and the host application.• Ensure that the stack size for your application is adjusted to factor in the stackdepth required for the operation of the touch libraries.Example for 8bit AVRThe example below will explain in detail the steps to follow for library selection.Criteria Selection NotesMicrocontrollerATMega1280IDE and compiler tool chainAVR STUDIO ® The GCC compiled variant of the libraries for theIDEuseddevice selected needs to be used.and GNU compilerNumber of Keys required 3 Each key requires 1 <strong>QTouch</strong> acquisition channelfor the applicationRotors and sliders required YesNumber of Rotors and 3 Each rotor / slider will require 3 channels.Sliders requiredNumber of Channelsrequired for the application( should be the sum of allchannels required for all thekeys ,rotors and slidersused in the design )12 3 Keys + ( 3 rotors x 3 channels per rotor/slider ) 12 channelsCharge cycle time requiredfor the design1 cycle Assuming the device is configured with a clockfrequency of 4MhzNumber of ports needed 3 ports This is determined based on the number ofchannels required and the routing required for thechannels SNS and SNSK pins to the portsFor this design, 24 pins are required and we need3 ports to support the sensors.Choice of ports availablefor the designSNS/SNSKPair1portsSNS/SNSKPair 2portsSNS1 Port: ASNSK1 Port: ASNS2 Port: BSNSK2 Port: CThe choice of ports for the port pairs is limited andcan be found in the section 5.7.1.5Is there a need for reducedpower consumption (andreduced execution time)?_POWER_OPTIMIZATION_ = 1Enabling _POWER_OPTIMIZATION_ will lead toa 40% reduction in power consumed by thelibrary, but at the expense of reduced externalnoise immunity. When power optimization isenabled, the unused pins within a port used for<strong>QTouch</strong>, may not be usable for interrupt drivenapplications. This option is available only forATtiny and ATmega devices.53