11.07.2015 Views

Atmel QTouch Library User Guide

Atmel QTouch Library User Guide

Atmel QTouch Library User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 51 Schematic overview of <strong>QTouch</strong> on Tiny40API Flow diagram for ATtiny40For the <strong>QTouch</strong> Libraries, the timing information is provided by the Host Application by updatingthe ‘time_current_ms’ variable in the Timer ISR. The <strong>QTouch</strong> <strong>Library</strong> uses this variable tocalculate the necessary timing for Max ON Duration, Drift and Recalibration functionality. Beforeusing the <strong>QTouch</strong> Libraries, the Timer ISR must be configured appropriately. Also, the TimerInterrupt is used to update the ‘time_to_measure_touch’ variable inorder to start a capacitivetouch measurement.The touch_config_dp.h configuration header file must be used to set the number of channelsbased on the library used. For example, if the library used is a 12 channel library thenQT_NUM_CHANNELS must be specified as 12 in the touch_config_dp.h. This information mustbe provided irrespective of the number of channels actually used.The desired number of touch buttons used can be enabled using the qt_enable_key() routine.The channel numbers are sequential from Port A through Port B. Also, individual sensorThreshold, Hysteresis, AKS group and Recalibration parameters can be set using this functioncall. The Sensor Global Configuration parameters can also be set by the user by directlyaccessing the global configuration data structure.When developing a Host application for ATtiny40 device, ensure that the ADC prescalar is set insuch a way that it is in the range of 50 KHz to 250 KHz. For example, if the main clock is runningat 8MHz then set the ADC prescalar to 32 or more. This must be done to ensure proper touchsensing acquisition.1768207K-AT42-09/11

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

Saved successfully!

Ooh no, something went wrong!