Atmel QTouch Library User Guide

Atmel QTouch Library User Guide Atmel QTouch Library User Guide

prochild.co.kr
from prochild.co.kr More from this publisher
11.07.2015 Views

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

• 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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!