Microchip® Advanced Software Framework

thirdparty/qtouch/devspecific/uc3/uc3l0/examples/example_qt/touch_config_at32uc3l.h File Reference

Macros

#define SET_PIN(x)   (1u << (x))
 Helper macro to include a selected pin. More...
 
Acquisition method manifest constants.

The following constants can be used to select the desired Touch acquisition methods to be used with the UC3L QTouch Library. Choose QMatrix, Autonomous QTouch, QTouch Group A and QTouch Group B methods by setting the corresponding macro to 1. It is possible for the QTouch Library to support one or more acquisition methods at the same time. For example, in order to use QMatrix and Autonomous QTouch acquisition methods at the same time, both DEF_TOUCH_QMATRIX and DEF_TOUCH_AUTONOMOUS_QTOUCH macros must be set to 1.

#define DEF_TOUCH_QMATRIX   (0)
 When 1, QMatrix method acquisition is used. More...
 
#define DEF_TOUCH_AUTONOMOUS_QTOUCH   (0)
 When 1, Autonomous QTouch method acquisition is used. More...
 
#define DEF_TOUCH_QTOUCH_GRP_A   (1)
 When 1, QTouch Group A method acquisition is used. More...
 
#define DEF_TOUCH_QTOUCH_GRP_B   (0)
 When 1, QTouch Group B method acquisition is used. More...
 
#define DEF_TOUCH_QDEBUG_ENABLE_QM   (0)
 Enable/Disable QDebug for touch debug information communication with QTouch Studio PC Software. More...
 
#define DEF_TOUCH_QDEBUG_ENABLE_AT   (0)
 
#define DEF_TOUCH_QDEBUG_ENABLE_QTA   (1)
 
#define DEF_TOUCH_QDEBUG_ENABLE_QTB   (0)
 
#define DEF_TOUCH_QDEBUG_ENABLE
 
QTouch Group A Sensor Configuration options.

QTouch Group A Clock dependency note: The Example application uses a PBA clock of 48MHz.

When the UC3L PBA Clock is changed to a different frequency, the following parameters must be changed accordingly to ensure proper QTouch Group A operation.

  1. QTA_CAT_CLK_DIV.
  2. TOUCH_SPREAD_SPECTRUM_MAX_DEV when Spread spectrum is enabled.

QTouch Group A resource requirement note. Caution:

  1. The QTouch Group A method acquisition using the CAT module requires one Peripheral DMA channel that must be provided by the application.
#define QTA_NUM_SENSORS   (4u)
 QTouch Group A number of Sensors. More...
 
#define QTA_NUM_ROTORS_SLIDERS   (2u)
 QTouch Group A number of Rotors and Sliders. More...
 
QTouch Group A Pin Configuration Options.
#define QTA_SP_SELECTED
 QTouch Group A Sense pair's selected. More...
 
QTouch Group A Clock and Register Configuration Options.
#define QTA_CAT_CLK_DIV   (23u)
 QTouch Group A CAT burst timing clock. More...
 
#define QTA_CHLEN   (3u)
 QTouch Group A Charge Length. More...
 
#define QTA_SELEN   (1u)
 QTouch Group A Settle Length. More...
 
#define QTA_DILEN   (255u)
 QTouch Group A Discharge Length. More...
 
#define QTA_DISHIFT   (0u)
 QTouch Group A Discharge Shift. More...
 
#define QTA_MAX_ACQ_COUNT   (3000u)
 QTouch Group A Maximum Count. More...
 
#define QTA_ENABLE_SPREAD_SPECTRUM   (1u)
 QTouch Group A Spread Spectrum Sensor Drive. More...
 
#define QTA_ENABLE_EXTERNAL_SYNC   (0u)
 QTouch Group A External synchronization to reduce 50 or 60 Hz mains interference. More...
 
QTouch Group A DMA Channel Options.
#define QTA_DMA_CHANNEL_0   (0u)
 QTouch Group A DMA Channel 0. More...
 
QTouch Group A Global acquisition parameters.

Refer the Touch Library User guide for more information on these parameters.

#define QTA_DI   (4u)
 QTouch Group A Sensor detect integration (DI) limit. More...
 
#define QTA_NEG_DRIFT_RATE   (20u)
 QTouch Group A Sensor negative drift rate. More...
 
#define QTA_POS_DRIFT_RATE   (5u)
 QTouch Group A Sensor positive drift rate. More...
 
#define QTA_MAX_ON_DURATION   (0u)
 QTouch Group A Sensor maximum on duration. More...
 
#define QTA_DRIFT_HOLD_TIME   (20u)
 QTouch Group A Sensor drift hold time. More...
 
#define QTA_POS_RECAL_DELAY   (10u)
 QTouch Group A Positive Recalibration delay. More...
 
#define QTA_RECAL_THRESHOLD   (RECAL_50)
 QTouch Group A Sensor recalibration threshold. More...
 
QTouch Group A Callback functions.
#define QTA_FILTER_CALLBACK   (NULL)
 QTouch Group A Filter callback function. More...
 
Touch common configuration options.
#define TOUCH_SYNC_PIN_OPTION   (USE_NO_PIN)
 Touch Sync Pin option. More...
 
#define TOUCH_SPREAD_SPECTRUM_MAX_DEV   (4u)
 Touch Maximum Deviation. More...
 
#define TOUCH_CSARES   (0x00000000)
 Touch Resistive Drive Enable for CSA lines. More...
 
#define TOUCH_CSBRES   (0x00000000)
 Touch Resistive Drive Enable for CSB lines. More...
 

#define DEF_TOUCH_AUTONOMOUS_QTOUCH   (0)

When 1, Autonomous QTouch method acquisition is used.

When 0, Autonomous QTouch method acquisition is not used.

#define DEF_TOUCH_QDEBUG_ENABLE
Value:
#define DEF_TOUCH_QDEBUG_ENABLE_QM
Enable/Disable QDebug for touch debug information communication with QTouch Studio PC Software...
Definition: thirdparty/qtouch/devspecific/uc3/uc3l0/examples/example_qt/touch_config_at32uc3l.h:141
#define DEF_TOUCH_QDEBUG_ENABLE_AT
Definition: thirdparty/qtouch/devspecific/uc3/uc3l0/examples/example_qt/touch_config_at32uc3l.h:142
#define DEF_TOUCH_QDEBUG_ENABLE_QTB
Definition: thirdparty/qtouch/devspecific/uc3/uc3l0/examples/example_qt/touch_config_at32uc3l.h:144
#define DEF_TOUCH_QDEBUG_ENABLE_QTA
Definition: thirdparty/qtouch/devspecific/uc3/uc3l0/examples/example_qt/touch_config_at32uc3l.h:143
#define DEF_TOUCH_QDEBUG_ENABLE_AT   (0)
#define DEF_TOUCH_QDEBUG_ENABLE_QM   (0)

Enable/Disable QDebug for touch debug information communication with QTouch Studio PC Software.

The QTouch Library supports Autonomous QTouch, QMatrix, QTouch Group A/B modes at the sametime. However, when using QDebug, it is only possible to send the Touch debug information related to any one mode, at a given time. Only one among the DEF_TOUCH_QDEBUG_ENABLE_xx manifest constants below should be set to 1.

When 1, QDebug debug data communication to QTouch Studio is enabled. When 0, QDebug debug data communication to QTouch Studio is disabled.

#define DEF_TOUCH_QDEBUG_ENABLE_QTA   (1)
#define DEF_TOUCH_QDEBUG_ENABLE_QTB   (0)
#define DEF_TOUCH_QMATRIX   (0)

When 1, QMatrix method acquisition is used.

When 0, QMatrix method acquisition is not used.

#define DEF_TOUCH_QTOUCH_GRP_A   (1)

When 1, QTouch Group A method acquisition is used.

When 0, QTouch Group A method acquisition is not used.

#define DEF_TOUCH_QTOUCH_GRP_B   (0)

When 1, QTouch Group B method acquisition is used.

When 0, QTouch Group B method acquisition is not used.

#define QTA_CAT_CLK_DIV   (23u)

QTouch Group A CAT burst timing clock.

The prescaler value is used to ensure that the CAT module clock (CLK_CAT) is divided to around 1 MHz to produce the burst timing clock. The prescaler uses the following formula to generate the burst timing clock: Burst timing clock = CLK_CAT / (2(DIV+1)) Range: 0u to 255u.

#define QTA_CHLEN   (3u)

QTouch Group A Charge Length.

For QTouch Group A sensors, specifies how many burst prescaler clock cycles should be used for transferring charge to the sense capacitor. Units: Burst timing clock Range: 0u to 255u.

#define QTA_DI   (4u)

QTouch Group A Sensor detect integration (DI) limit.

Range: 0u to 255u.

#define QTA_DILEN   (255u)

QTouch Group A Discharge Length.

For QTouch Group A sensors, specifies how many clock cycles the CAT should use to discharge the capacitors before charging them. Units: Burst timing clock Range: 0u to 255u.

#define QTA_DISHIFT   (0u)

QTouch Group A Discharge Shift.

For QTouch Group A sensors, specifies how many bits the DILEN field should be shifted before using it to determine the discharge time. Range: 0u to 3u.

#define QTA_DMA_CHANNEL_0   (0u)

QTouch Group A DMA Channel 0.

Specify the DMA Channel option 0 to be used by the CAT module for transfer of Acquisition count from CAT register to memory. Range: 0u to 11u.

Referenced by main().

#define QTA_DRIFT_HOLD_TIME   (20u)

QTouch Group A Sensor drift hold time.

Units: 200ms Default value: 20 (hold off drifting for 4 seconds after leaving detect). Range: 1u to 255u.

#define QTA_ENABLE_EXTERNAL_SYNC   (0u)

QTouch Group A External synchronization to reduce 50 or 60 Hz mains interference.

0u: For QTouch Group A sensors, specifies that external synchronization is disabled. 1u: For QTouch Group A sensors, specifies that external synchronization mode is enabled using the TOUCH_SYNC_PIN_OPTION pin option provided. Refer TOUCH_SYNC_PIN_OPTION option.

#define QTA_ENABLE_SPREAD_SPECTRUM   (1u)

QTouch Group A Spread Spectrum Sensor Drive.

0u: For QTouch Group A sensors, specifies that spread spectrum sensor drive shall not be used. 1u: For QTouch Group A sensors, specifies that spread spectrum sensor drive shall be used.

#define QTA_FILTER_CALLBACK   (NULL)

QTouch Group A Filter callback function.

A filter callback (when not NULL) is called by the Touch Library each time a new set of Signal values are available. An Example filter callback function prototype. void qt_grp_a_filter_callback( touch_filter_data_t *p_filter_data );

#define QTA_MAX_ACQ_COUNT   (3000u)

QTouch Group A Maximum Count.

For QTouch Group A sensors, specifies how many counts (signal value) the maximum acquisition should be. Range: 0u to 65535u.

#define QTA_MAX_ON_DURATION   (0u)

QTouch Group A Sensor maximum on duration.

Units: 200ms (Example: a value 5u indicated Max ON duration of 1 second.) Default value: 0 (No maximum ON time limit). Range: 0u to 255u.

#define QTA_NEG_DRIFT_RATE   (20u)

QTouch Group A Sensor negative drift rate.

Units: 200ms Default value: 20u = 4 seconds. Range: 1u to 127u.

#define QTA_NUM_ROTORS_SLIDERS   (2u)

QTouch Group A number of Rotors and Sliders.

Specify the total number of QTouch Group A Rotors and Sliders to be used by the Touch Library. The number of Rotors and Sliders mentioned here is part of the Total number of sensors specified in the QTA_NUM_SENSORS macro. When no rotors or slider are required, specify a value of 0u.

#define QTA_NUM_SENSORS   (4u)

QTouch Group A number of Sensors.

Specify the number of QTouch Group A touch sensors to be used by the Touch Library. A sensor is either a key, rotor or slider. Example configuration: If the configuration has 6 keys (a key is formed using one channel), one rotor (a QTouch Group A rotor is formed using 3 channels) and one slider (a QTouch Group A slider is formed using 3 channels), then the number of sensors is 6 key + 1 rotor + 1 slider = 8 sensors. Range: 1u to (number of Sense pairs specified in QTA_SP_SELECTED).

#define QTA_POS_DRIFT_RATE   (5u)

QTouch Group A Sensor positive drift rate.

Units: 200ms Default value: 5u = 1 second. Range: 1u to 127u.

#define QTA_POS_RECAL_DELAY   (10u)

QTouch Group A Positive Recalibration delay.

Default value: 10. Range: 1u to 255u.

#define QTA_RECAL_THRESHOLD   (RECAL_50)

QTouch Group A Sensor recalibration threshold.

Default: RECAL_50 (recalibration threshold = 50% of detection threshold). Range: refer recal_threshold_t enum in touch_api_at32uc3l.h.

#define QTA_SELEN   (1u)

QTouch Group A Settle Length.

For QTouch Group A sensors, specifies how many burst prescaler clock cycles should be used for settling after charge transfer. Units: Burst timing clock Range: 0u to 255u.

#define QTA_SP_SELECTED
Value:
Definition: avr32/applications/uc3l-ek-touch-demo/touch_api_at32uc3l.h:499
Definition: avr32/applications/uc3l-ek-touch-demo/touch_api_at32uc3l.h:498
Definition: avr32/applications/uc3l-ek-touch-demo/touch_api_at32uc3l.h:505
Definition: avr32/applications/uc3l-ek-touch-demo/touch_api_at32uc3l.h:506
Definition: avr32/applications/uc3l-ek-touch-demo/touch_api_at32uc3l.h:512
Definition: avr32/applications/uc3l-ek-touch-demo/touch_api_at32uc3l.h:513
Definition: avr32/applications/uc3l-ek-touch-demo/touch_api_at32uc3l.h:504
#define SET_PIN(x)
Helper macro to include a selected pin.
Definition: thirdparty/qtouch/devspecific/uc3/uc3l0/examples/example_qt/touch_config_at32uc3l.h:156
Definition: avr32/applications/uc3l-ek-touch-demo/touch_api_at32uc3l.h:502

QTouch Group A Sense pair's selected.

Specify the Sense pair's to be used for QTouch Group A. Choose from SP0 to SP16. Setting Bit'n' indicates that Sense Pair SPn is selected. Use the SET_PIN() macro to select the required Sense pair. Refer qt_pin_options_t enum in touch_api_at32uc3l.h file.

#define SET_PIN (   x)    (1u << (x))

Helper macro to include a selected pin.

#define TOUCH_CSARES   (0x00000000)

Touch Resistive Drive Enable for CSA lines.

This option can be used to enable 1kOhm resistive drive capability, if available on a specific CSA pin. For the UC3L, the following CSA[n] pin have the resistive drive capability - CSARES: 0x0001AEEEu When bit n is 0, CSA[n] has the same drive properties as normal I/O pads. When bit n is 1, CSA[n] has a nominal output resistance of 1kOhm during the burst phase. Refer Table 28-2. Pin Selection Guide.

#define TOUCH_CSBRES   (0x00000000)

Touch Resistive Drive Enable for CSB lines.

This option can be used to enable 1kOhm resistive drive capability, if available on a specific CSA pin. For the UC3L, the following CSB[n] pin have the resistive drive capability - CSBRES: 0x0000BEECu When bit n is 0, CSB[n] has the same drive properties as normal I/O pads. When bit n is 1, CSB[n] has a nominal output resistance of 1kOhm during the burst phase. Refer Table 28-2. Pin Selection Guide.

#define TOUCH_SPREAD_SPECTRUM_MAX_DEV   (4u)

Touch Maximum Deviation.

When spread spectrum burst is enabled using the QM_ENABLE_SPREAD_SPECTRUM option, MAX_DEV indicates the maximum number of prescaled clock cycles the burst pulse will be extended or shortened. Range: When only QMatrix is used, 0u to ((2u * QM_CAT_CLK_DIV) + 1u). Range: When only Autonomous QTouch is used, 0u to ((2u * AT_CAT_CLK_DIV) + 1u). Range: When only QTouch Group A is used, 0u to ((2u * QTA_CAT_CLK_DIV) + 1u). Range: When only QTouch Group B is used, 0u to ((2u * QTB_CAT_CLK_DIV) + 1u). Range: When a combination of QMatrix, Autonomous QTouch, QTouch Group A or QTouch Group B is used, 0u to ((2u * least of(QM_CAT_CLK_DIV, AT_CAT_CLK_DIV, QTA_CAT_CLK_DIV, QTB_CAT_CLK_DIV )) + 1u)

#define TOUCH_SYNC_PIN_OPTION   (USE_NO_PIN)

Touch Sync Pin option.

Specify the sync pin option, if included in the hardware design. To prevent interference from the 50 or 60 Hz mains line the CAT can trigger acquisition on the SYNC signal. The SYNC signal should be derived from the mains line. The acquisition will trigger on a falling edge of this signal. Refer general_pin_options_t enum in touch_api_at32uc3l.h file.