Atmel Software Framework

xmega/applications/xmega_a3bu_xplained_classb_oven/drv/touch.c File Reference

Touch button driver.

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

#include <compiler.h>
#include <tc.h>
#include <touch_api.h>
#include "touch.h"
#include "QDebug.h"
#include "QDebugTransport.h"

Macros

#define TOUCH_GET_SENSOR_STATE(SENSOR_NUMBER)
 Convenience macro for getting state of touch sensor. More...
 
#define TOUCH_TC   TCD0
 Timer/counter for timing touch measurements. More...
 
#define TOUCH_TC_PERIOD_MS   25
 Period in milliseconds between each touch measurement. More...
 

Functions

static void touch_config_sensor (void)
 Configure the touch sensor. More...
 
void touch_init (void)
 Configure QTouch library and measurement setup. More...
 
static void touch_init_timer_isr (void)
 Configure timer interrupts for touch measurements. More...
 
bool touch_key_is_pressed (void)
 Check if user is pressing the touch key. More...
 
static void touch_set_parameters (void)
 Pass default parameters to QTouch library. More...
 
static void touch_timer_period_handler (void)
 Callback function for timer period interrupt. More...
 

Variables

static volatile uint16_t current_time_ms_touch = 0
 Current time, set by timer period callback. More...
 
qt_touch_lib_measure_data_t *const pqt_measure_data = &qt_measure_data
 QTouch measurement data pointer for debug purposes. More...
 
qt_touch_lib_config_data_t qt_config_data
 QTouch configuration struct. More...
 
qt_touch_lib_measure_data_t qt_measure_data
 QTouch measurement data struct. 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 period callback to trigger touch measurements. More...
 

#define TOUCH_GET_SENSOR_STATE (   SENSOR_NUMBER)
Value:
( \
& (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
uint8_t sensor_states[QT_NUM_SENSOR_STATE_BYTES]
The state (on/off) of the library sensors.
Definition: thirdparty/qtouch/generic/include/touch_api.h:860

Convenience macro for getting state of touch sensor.

Referenced by touch_key_is_pressed().

#define TOUCH_TC   TCD0

Timer/counter for timing touch measurements.

Referenced by touch_init_timer_isr().

#define TOUCH_TC_PERIOD_MS   25

Period in milliseconds between each touch measurement.

Referenced by touch_init_timer_isr(), and touch_timer_period_handler().

static void touch_config_sensor ( void  )
static

Configure the touch sensor.

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

Referenced by touch_init().

void touch_init ( void  )

Configure QTouch library and measurement setup.

Configures touch library and measurement setup.

Referenced by main().

static void touch_init_timer_isr ( void  )
static
bool touch_key_is_pressed ( void  )

Check if user is pressing the touch key.

Return values
trueif key is pressed.
falseif key is not pressed.

References current_time_ms_touch, QDebug_ProcessCommands(), QDebug_SendData(), qt_measure_sensors(), QTLIB_BURST_AGAIN, time_to_measure_touch, and TOUCH_GET_SENSOR_STATE.

Referenced by keyboard_get_key_state(), and main().

static void touch_timer_period_handler ( void  )
static

Callback function for timer period interrupt.

References current_time_ms_touch, time_to_measure_touch, and TOUCH_TC_PERIOD_MS.

Referenced by touch_init_timer_isr().

volatile uint16_t current_time_ms_touch = 0
static

Current time, set by timer period callback.

Referenced by touch_key_is_pressed(), and touch_timer_period_handler().

qt_touch_lib_measure_data_t* const pqt_measure_data = &qt_measure_data

QTouch measurement data pointer for debug purposes.

qt_touch_lib_measure_data_t qt_measure_data

QTouch measurement data struct.

Referenced by Transmit_Ref(), Transmit_Signals(), and Transmit_State().

TOUCH_DATA_T SNS_array[2][2]

Referenced by touch_init().

TOUCH_DATA_T SNSK_array[2][2]

Referenced by touch_init().

volatile bool time_to_measure_touch = false
static

Flag set by timer period callback to trigger touch measurements.

Referenced by touch_key_is_pressed(), and touch_timer_period_handler().