Atmel Software Framework

xmega/applications/xmega_a3bu_xplained_demo/qtouch/touch.c File Reference

QTouch Sensor interface.

Copyright (c) 2010-2015 Atmel Corporation. All rights reserved.

#include <asf.h>
#include "touch_api.h"
#include "QDebug.h"
#include "QDebugTransport.h"

Macros

#define GET_SENSOR_STATE(SENSOR_NUMBER)
 

Functions

bool check_touch_key_pressed (void)
 Checks whether the QTouch key is pressed. More...
 
static void config_sensor (void)
 
static void init_timer_isr (void)
 
int16_t qt_get_sensor_delta (uint8_t sensor)
 Get sensor delta values. More...
 
static void qt_set_parameters (void)
 Passes default parameters from config file to touch library. More...
 
void touch_init (void)
 Configures touch library and measurement setup. More...
 
static void touch_timer_callback ()
 

Variables

static volatile uint16_t current_time_ms_touch = 0
 Current time, set by timer ISR. More...
 
qt_touch_lib_measure_data_tpqt_measure_data = &qt_measure_data
 Output can be observed in the watch window using this pointer. More...
 
qt_touch_lib_config_data_t qt_config_data
 This configuration data structure parameters if needs to be changed will be changed in the qt_set_parameters function. More...
 
qt_touch_lib_measure_data_t qt_measure_data
 Touch output - measurement data. More...
 
uint16_t qt_measurement_period_msec = 25
 Timer period in msec. More...
 
TOUCH_DATA_T SNS_array [2][2]
 
TOUCH_DATA_T SNSK_array [2][2]
 
static volatile bool time_to_measure_touch = false
 Flag set by timer ISR when it's time to measure touch. More...
 

#define GET_SENSOR_STATE (   SENSOR_NUMBER)
Value:
sensor_states[(SENSOR_NUMBER / 8)] & (1 << (SENSOR_NUMBER % 8))
qt_touch_lib_measure_data_t qt_measure_data
QTouch measurement data struct.
qt_touch_status_t qt_touch_status
state of sensors.
Definition: thirdparty/qtouch/generic/include/touch_api.h:899

Referenced by check_touch_key_pressed().

bool check_touch_key_pressed ( void  )
static void config_sensor ( void  )
static

References CHANNEL_0, HYST_6_25, NO_AKS_GROUP, and qt_enable_key().

Referenced by touch_init().

int16_t qt_get_sensor_delta ( uint8_t  sensor)

Get sensor delta values.

void touch_init ( void  )

Configures touch library and measurement setup.

Configure QTouch library and measurement setup.

Precondition
Interrupts must be enabled in order to trigger regular measurements The touch configuration requires a fixed CPU speed to work properly in this case we need 2 MHz.

References config_sensor(), init_timer_isr(), QDebug_Init(), qt_filter_callback, qt_init_sensing, qt_set_parameters(), SNS_array, SNSK_array, touch_config_sensor(), touch_init_timer_isr(), and touch_set_parameters().

static void touch_timer_callback ( )
static

volatile uint16_t current_time_ms_touch = 0
static

Current time, set by timer ISR.

Referenced by check_touch_key_pressed(), and touch_timer_callback().

Output can be observed in the watch window using this pointer.

This configuration data structure parameters if needs to be changed will be changed in the qt_set_parameters function.

qt_touch_lib_measure_data_t qt_measure_data

Touch output - measurement data.

TOUCH_DATA_T SNS_array[2][2]
TOUCH_DATA_T SNSK_array[2][2]
volatile bool time_to_measure_touch = false
static

Flag set by timer ISR when it's time to measure touch.

Referenced by check_touch_key_pressed(), and touch_timer_callback().