For the QTouch Libraries, the timing information is provided by the Host Application by updating the ‘time_current_ms’ variable in the Timer ISR. The QTouch Library uses this variable to calculate the necessary timing for Max ON Duration, Drift and Recalibration functionality. Before using the QTouch Libraries, the Timer ISR must be configured appropriately. Also, the Timer Interrupt is used to update the ‘time_to_measure_touch’ variable inorder to start a capacitive touch measurement. It is recommended to call qt_measure_sensors within 100ms each time to avoid error in QTouch Library timing.
The touch_config_tiny20.h configuration header file can be used to set the desired number of Touch Sensors (Buttons) as well as individual sensor Threshold, Hysteresis and Recalibration parameters. The Sensor Global Configuration parameters must be specified using the IAR Linker define options.