Atmel AVR8015
25
32185A-AVR-01/12
Place this piece of code under the label
/* Configure a 4 channel Slider as Sensor 1. */
Similarly configure the other sliders under the corresponding labels.
NOTE
The RES_8_BIT argument is the slider resolution.
3. Similarly, for enabling the rotor using channels 0, 1, 2, and 3 using the following
code:
touch_ret =
touch_qm_sensor_config
(SENSOR_TYPE_ROTOR,
(channel_t)
0u,
(channel_t)
3u,
AKS_GROUP_1,
25u,
HYST_6_25,
RES_8_BIT,
0u,
&sensor_id);
if (touch_ret != TOUCH_SUCCESS)
{
while (1u);
/* Check API Error return code. */
}
Place this piece of code under the label
/* Configure a 4 channel Rotor as Sensor 0. */
Similarly configure the other rotors under the corresponding labels. The other
arguments are not too important right now.
4. Add the following piece of code after the
init_system();
call, after the label
/* Configure the touch library sensors. */
touch_ret = config_64ch_touch_keys_rotors_sliders ();
if (touch_ret != TOUCH_SUCCESS)
{
while (1u);
/* Check API Error return code. */
}
Configuring burst length.
1. Call
qm_burst_length
, to configure the burst length array starting index. Add this
against the label /* QMatrix burst length array starting index.*/ in the structure
static
touch_qm_config_t qm_config
.
2. Find this array and define the burst lengths for the sensors as below.
32u,
/* x0, y0 */
32u,
/* x1, y0 */
32u,
/* x2, y0 */
32u,
/* x3, y0 */
48u,
/* x4, y0 */
48u,
/* x5, y0 */
48u,
/* x8, y0 */
48u,
/* x9, y0 */
3. Similarly enter the burst length values for all the sensors up to (x9, y7).
Somewhere to store time.
We are now almost ready to start taking measurements. Touch measurement is taken
by calling
touch_qm_sensors_start_acquisition
(
current_time_ms_touch,
&qm_dma
,
NORMAL_ACQ_MODE
,
touch_qm_measure_complete_callback
), but as you
can see, it expects an argument. This argument is used to keep track of time to allow
compensating for over-time drifting in the measured values. If you are not concerned
with drifting, you can pass this argument as zero.