Atmel QTouch Library User Guide
Atmel QTouch Library User Guide Atmel QTouch Library User Guide
QTouch Library configuration parameters for ATtiny20The Table below describes the various configuration parameters corresponding to the ATtiny20.ParameterDEF_QT_QDEBUG_ENABLEDEF_QT_NUM_SENSORSDEF_QT_SENSOR_0_THRESHOLD,DEF_QT_SENSOR_1_THRESHOLD,DEF_QT_SENSOR_2_THRESHOLD,DEF_QT_SENSOR_3_THRESHOLD,DEF_QT_SENSOR_4_THRESHOLDDEF_QT_SENSOR_0_HYSTERESIS,DEF_QT_SENSOR_1_HYSTERESIS,DEF_QT_SENSOR_2_HYSTERESIS,DEF_QT_SENSOR_3_HYSTERESIS,DEF_QT_SENSOR_4_HYSTERESISDEF_QT_SENSOR_0_RECAL_THRESHOLD,DEF_QT_SENSOR_1_RECAL_THRESHOLD,DEF_QT_SENSOR_2_RECAL_THRESHOLD,DEF_QT_SENSOR_3_RECAL_THRESHOLD,DEF_QT_SENSOR_4_RECAL_THRESHOLDDEF_QT_DELAY_CYCLESDEF_QT_ADC_CHANNEL_START_INDEXDEF_QT_AKS_ENABLEDEF_QT_DIDEF_QT_NEG_DRIFT_RATE*(See Note 1)DEF_QT_POS_DRIFT_RATE*(See Note 1)DEF_QT_MAX_ON_DURATIONDEF_QT_DRIFT_HOLD_TIMEDEF_QT_POS_RECAL_DELAYDEF_QT_NUM_SENSORS_SYMDEF_QT_BURST_LENGTHDescriptionEnable/Disable QDebug debug data communication to QTouchStudio.QTouch number of Sensors.Range: 1u to 5u.Sensor detection threshold value.Range: 1u to 255u.Sensor detection hysteresis value. Refer hysteresis_t intouch_api_tiny20.hHYST_50 = (50% of Sensor detection threshold value)HYST_25 = (25% of Sensor detection threshold value)HYST_12_5 = (12.5% of Sensor detection threshold value)HYST_6_25 = (6.25%, but value is hardlimited to 2)Sensor recalibration threshold value. Refer recal_threshold_t intouch_api_tiny20.hRECAL_100 = (100% of Sensor detection threshold value)RECAL_50 = (50% of Sensor detection threshold value)RECAL_25 = (25% of Sensor detection threshold value)RECAL_12_5 = (12.5% of Sensor detection threshold value)RECAL_6_25 = (6.25%, but value is hardlimited to 4)Delay cycles that determine the capacitance charge transfer time.Range: 1, 2, 4, 8 or 10 internal System Clock cycles.ADC Channel starting index.Range: 1u to 7u.Enable/Disable Adjacent Key suppression (AKS) on all channels.Sensor detect integration (DI) limit.Range: 0u to 255u.Refer Section 5.3 and Section 5.4 for more info.Sensor negative drift rate. Units: 100ms, Range: 1u to 127u.Refer Section 5.3 and Section 5.4 for more info.Sensor positive drift rate. Units: 100ms, Range: 1u to 127u.Refer Section 5.3 and Section 5.4 for more info.Sensor maximum on duration. Units: 100ms, Range: 0u to 255u.Refer Section 5.3 and Section 5.4 for more info.Sensor drift hold time. Units: 100ms, Range: 1u to 255u.Refer Section 5.3 and Section 5.4 for more info.Positive Recalibration delay. Range: 1u to 255u.Refer Section 5.3 and Section 5.4 for more info.QTouch number of Sensors Symbol for QTouch Library.MUST be the same as DEF_QT_NUM_SENSORS.Specifies the no:of burst sequence required for a sensor. Multipleburst for adjusting sensitivity by increasing the resolution of the Signalmeasured.Use higher value for increasing sensitivity.Values: 1u, 4u and 16u1728207K-AT42-09/11
Table 18 QTouch Library for ATtiny20 Configuration parametersNote1:For the case of ATtiny20 devices, a ‘touch’ causes the Signal value measured on the Sensor toincrease above the Sensor Reference value (In the case of Generic Library devices, a ‘touch’causes the Signal value to decrease below the Reference value).However, the Negative drift rate and Positive drift rate functionality for the case of Tiny20 devicesshall be consistent with the Generic Library case.So, it is recommended to have a ‘Slower’ Negative Drift rate (4 seconds is the default setting) anda ‘Faster’ Positive Drift rate (1 second is the default setting) for the Tiny20 device.QTouch Library ATtiny20 Example projectsThe QTouch method IAR Example project for the Tiny20 Evaluation Kit can be found in thefollowing path.\Device_Specific_Libraries\8bit_AVR\AVR_Tiny_Mega_XMega\ATtiny20\tiny20_ek_iar_qt_exampleThe Example projects demonstrate the 5 button sensor configuration with a Sample LEDapplication. The Example projects also support QDebug data transfer to QTouch Studio – TouchAnalyzer PC Application.It is possible to configure the number of Sensors in the Example project from 1 to 5 for testing onthe ATtiny20 Evaluation kit.QTouch Library ATtiny20 code and data memory requirementsThe code and data memory requirements for QTouch Library for ATtiny20 devices is captured inthe Table below. The Table indicates these values for the standalone library and not for theentire Example Project application.Librarylibtiny20-5qt-k-0rslibtiny20-5qt-k-0rslibtiny20-5qt-k-0rslibtiny20-5qt-k-0rslibtiny20-5qt-k-0rsNumber ofSensors54321Code Memory1231 + 15 bytesConst data1231 + 12 bytesConst data1231 + 9 bytesConst data1231+ 6 bytesConst data1231 + 3 bytesConst data7060504030DatamemoryCStack/RStackCStack= 0x1C bytesRStack= 10(16 bytes) is theRecommended setting.CStack= 0x1C bytesRStack= 10(16 bytes) is theRecommended setting.CStack= 0x1C bytesRStack= 10(16 bytes) is theRecommended setting.CStack= 0x1C bytesRStack= 10(16 bytes) is theRecommended setting.CStack= 0x1C bytesRStack= 10(16 bytes) is the173
- Page 122 and 123: Figure 37 QMatrix method schematicQ
- Page 124 and 125: Figure 39 QMatrix API Flow diagram
- Page 126 and 127: CAT Module Pin NameCSA0CSB0CSA1CSB1
- Page 128 and 129: The QTouch method acquisition using
- Page 130 and 131: Host Application codeUsing the init
- Page 132 and 133: Frozen Stop Stop Run Run Run Run On
- Page 134 and 135: Figure 45 Raw acquisition mode API
- Page 136 and 137: Figure 46 GNU Example project usage
- Page 138 and 139: the QTouch Library as QMatrix data
- Page 140 and 141: TOUCH_STATUS_CHANGE 0x0002u Status
- Page 142 and 143: sensor_type_tEnumerationUsesensor_t
- Page 144 and 145: OUT_OF_TOUCHIN_TOUCHCurrently the a
- Page 146 and 147: num_channel_signals uint8_t Length
- Page 148 and 149: touch_at_statusstructureInput / Out
- Page 150 and 151: UseData structure which holds the R
- Page 152 and 153: variable to the Touch library. The
- Page 154 and 155: structure.p_qta_config touch_qt_con
- Page 156 and 157: p_touch_sensor_param touch_qm_param
- Page 158 and 159: current_time_ms touch_time_t Curren
- Page 160 and 161: touch_ret_t touch_qt_sensor_config(
- Page 162 and 163: touch_qt_sensors_calibratetouch_ret
- Page 164 and 165: touch_qt_get_libinfotouch_ret_t tou
- Page 166 and 167: • This API updates the configurat
- Page 168 and 169: Rule Rule Description Advisory/Requ
- Page 170 and 171: VCCPA0No ConnectionPA1PA2ATtiny20PA
- Page 174 and 175: Recommended setting.Table 19 QTouch
- Page 176 and 177: Figure 51 Schematic overview of QTo
- Page 178 and 179: QTouch Library configuration parame
- Page 180 and 181: Devices supportedThe list of differ
- Page 182 and 183: • The channel number is derived f
- Page 184 and 185: MISRA Compliance ReportThis section
- Page 186 and 187: May 2010Ver 4.2July 2010Ver 4.3Jan
Table 18 <strong>QTouch</strong> <strong>Library</strong> for ATtiny20 Configuration parametersNote1:For the case of ATtiny20 devices, a ‘touch’ causes the Signal value measured on the Sensor toincrease above the Sensor Reference value (In the case of Generic <strong>Library</strong> devices, a ‘touch’causes the Signal value to decrease below the Reference value).However, the Negative drift rate and Positive drift rate functionality for the case of Tiny20 devicesshall be consistent with the Generic <strong>Library</strong> case.So, it is recommended to have a ‘Slower’ Negative Drift rate (4 seconds is the default setting) anda ‘Faster’ Positive Drift rate (1 second is the default setting) for the Tiny20 device.<strong>QTouch</strong> <strong>Library</strong> ATtiny20 Example projectsThe <strong>QTouch</strong> method IAR Example project for the Tiny20 Evaluation Kit can be found in thefollowing path.\Device_Specific_Libraries\8bit_AVR\AVR_Tiny_Mega_XMega\ATtiny20\tiny20_ek_iar_qt_exampleThe Example projects demonstrate the 5 button sensor configuration with a Sample LEDapplication. The Example projects also support QDebug data transfer to <strong>QTouch</strong> Studio – TouchAnalyzer PC Application.It is possible to configure the number of Sensors in the Example project from 1 to 5 for testing onthe ATtiny20 Evaluation kit.<strong>QTouch</strong> <strong>Library</strong> ATtiny20 code and data memory requirementsThe code and data memory requirements for <strong>QTouch</strong> <strong>Library</strong> for ATtiny20 devices is captured inthe Table below. The Table indicates these values for the standalone library and not for theentire Example Project application.<strong>Library</strong>libtiny20-5qt-k-0rslibtiny20-5qt-k-0rslibtiny20-5qt-k-0rslibtiny20-5qt-k-0rslibtiny20-5qt-k-0rsNumber ofSensors54321Code Memory1231 + 15 bytesConst data1231 + 12 bytesConst data1231 + 9 bytesConst data1231+ 6 bytesConst data1231 + 3 bytesConst data7060504030DatamemoryCStack/RStackCStack= 0x1C bytesRStack= 10(16 bytes) is theRecommended setting.CStack= 0x1C bytesRStack= 10(16 bytes) is theRecommended setting.CStack= 0x1C bytesRStack= 10(16 bytes) is theRecommended setting.CStack= 0x1C bytesRStack= 10(16 bytes) is theRecommended setting.CStack= 0x1C bytesRStack= 10(16 bytes) is the173