QTouch Group A/B method API Flow for UC3L

For the QTouch operation, the CAT_CLK must be setup appropriately as a first step.  Depending on QTouch Group that need to be used, the QTouch Group A, QTouch Group B and Common configuration parameters in the touch_config_at32uc3l.h configuration must then be set up.

The first input argument to the QTouch API, TOUCH_QT_GRP_A or TOUCH_QT_GRP_B indicates if the QTouch API must perform the necessary operation on Group A Sensors or Group B Sensors.  The touch_qt_sensors_init API initializes the QTouch Library as well as the CAT module and does the QTouch method specific pin, register and Global Sensor configuration.  The touch_qt_sensor_config API is used to configure individual sensor.  The Sensor specific configuration parameter can be provided as input to this API.    

The touch_qt_sensors_calibrate API is used to calibrate all the configured sensors thereby preparing the sensors for acquisition.  The touch_qt_sensors_start_acquisition API initiates a QTouch method measurement on all the configured Sensors (corresponding to the input Touch Group A or B).  This API takes the peripheral DMA channels as an input.  When a filter_callback function is enabled, the touch_event_dispatcher function calls the filter_callback function as soon as the raw acquisition data from the Sensors is available.  The user can now optionally apply any filtering routine on the raw acquisition data before the QTouch Library does any processing on this data (For an overview of Filter callback usage, refer Allocating unused Port Pins for User Application for example code).

Once the QTouch Library has finished processing the acquisition data from Sensors, the touch_event_dispatcher function calls the measure_complete_callback function indicating the end of a single Touch measurement operation.  The measure_complete_callback provides the measured data and Touch status information.  The measured data is available in the same order of Touch Channel numbering.  Separate Filter and Measure complete callback functions must be provided for Group A and Group B Sensors.

Note:

The Host Application code can execute once a QTouch acquisition is initiated with the touch_qt_sensors_start_acqusition API.  Care must be taken in the Host Application such that the touch_event_dispatcher function is called frequently in order to process the acquired data.  For a single Touch measurement operation (between a touch_qt_sensors_start_acquisition API call and the measure_complete_callback function being called), the touch_event_dispatcher function may execute multiple times in order to resolve the Touch status of Sensors.  Failing to call the touch_event_dispatcher frequently can adversely impact the Touch Sensitivity.

Figure 1. QTouch method API Flow diagram