QTouch Example for QT600-ATXMEGA128A1-QT16 board.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include <avr/io.h>
#include <avr/interrupt.h>
#include "touch_api.h"
#include "QDebug.h"
#include "QDebugTransport.h"
#include "sysclk.h"
#include "pmic.h"
#include "tc.h"
Macros | |
#define | __delay_cycles(n) __builtin_avr_delay_cycles(n) |
#define | __enable_interrupt() sei() |
#define | GET_ROTOR_SLIDER_POSITION(ROTOR_SLIDER_NUMBER) qt_measure_data.qt_touch_status.rotor_slider_values[ROTOR_SLIDER_NUMBER] |
#define | GET_SENSOR_STATE(SENSOR_NUMBER) qt_measure_data.qt_touch_status.sensor_states[(SENSOR_NUMBER/8)] & (1 << (SENSOR_NUMBER % 8)) |
TIMER_PERIOD conmputation | |
#define | TIMER_PERIOD TICKS_PER_MS * qt_measurement_period_msec |
The timing information for timer to fire periodically to measure touch | |
#define | TIMER_COUNTER_L TCC0.CNTL |
#define | TIMER_COUNTER_H TCC0.CNTH |
Functions | |
static void | example_cca_interrupt_callback (void) |
static void | init_system (void) |
static void | init_timer_isr (void) |
Configure timer ISR to fire regularly. More... | |
int | main (void) |
code main entry point More... | |
int16_t | qt_get_sensor_delta (uint8_t sensor) |
static void | qt_set_parameters (void) |
qt_set_parameters function More... | |
Variables | |
volatile uint16_t | current_time_ms_touch = 0u |
Current time, set by timer ISR. More... | |
unsigned int | gMsTimeout |
qt_touch_lib_measure_data_t * | pqt_measure_data = &qt_measure_data |
qt_touch_lib_config_data_t | qt_config_data |
qt_touch_lib_measure_data_t | qt_measure_data |
uint16_t | qt_measurement_period_msec = 25u |
Touch Measurement period in milliseconds. More... | |
static volatile uint8_t | time_to_measure_touch = 0u |
Flag set by timer ISR when it's time to measure touch. More... | |
uint16_t | timestamp1_hword |
Time stamp information. More... | |
uint16_t | timestamp1_lword |
uint16_t | timestamp2_hword |
uint16_t | timestamp2_lword |
uint16_t | timestamp3_hword |
uint16_t | timestamp3_lword |
#define __delay_cycles | ( | n | ) | __builtin_avr_delay_cycles(n) |
#define __enable_interrupt | ( | ) | sei() |
Referenced by main().
#define GET_ROTOR_SLIDER_POSITION | ( | ROTOR_SLIDER_NUMBER | ) | qt_measure_data.qt_touch_status.rotor_slider_values[ROTOR_SLIDER_NUMBER] |
#define GET_SENSOR_STATE | ( | SENSOR_NUMBER | ) | qt_measure_data.qt_touch_status.sensor_states[(SENSOR_NUMBER/8)] & (1 << (SENSOR_NUMBER % 8)) |
#define TIMER_COUNTER_H TCC0.CNTH |
Referenced by main().
#define TIMER_COUNTER_L TCC0.CNTL |
Referenced by main().
#define TIMER_PERIOD TICKS_PER_MS * qt_measurement_period_msec |
Referenced by init_timer_isr().
|
static |
References current_time_ms_touch, gMsTimeout, qt_measurement_period_msec, and time_to_measure_touch.
Referenced by main().
|
static |
|
static |
Configure timer ISR to fire regularly.
References PMIC_LVL_LOW, tc_enable(), tc_set_cca_interrupt_level(), tc_write_clock_source(), tc_write_period(), and TIMER_PERIOD.
Referenced by main().
int main | ( | void | ) |
code main entry point
References __enable_interrupt, CHANNEL_0, CHANNEL_1, CHANNEL_10, CHANNEL_12, CHANNEL_13, CHANNEL_15, CHANNEL_2, CHANNEL_3, CHANNEL_4, CHANNEL_5, CHANNEL_6, CHANNEL_7, CHANNEL_8, CHANNEL_9, cpu_irq_enable, current_time_ms_touch, example_cca_interrupt_callback(), HYST_50, HYST_6_25, init_timer_isr(), NO_AKS_GROUP, pmic_init(), QDebug_Init(), QDebug_ProcessCommands(), QDebug_SendData(), qt_enable_key(), qt_enable_rotor(), qt_enable_slider(), qt_filter_callback, qt_init_sensing, qt_measure_sensors(), qt_set_parameters(), QTLIB_BURST_AGAIN, RES_8_BIT, sysclk_init(), tc_set_cca_interrupt_callback(), time_to_measure_touch, TIMER_COUNTER_H, TIMER_COUNTER_L, timestamp1_hword, timestamp1_lword, timestamp2_hword, timestamp2_lword, timestamp3_hword, and timestamp3_lword.
int16_t qt_get_sensor_delta | ( | uint8_t | sensor | ) |
Referenced by Transmit_Delta().
|
static |
qt_set_parameters function
This will fill the default threshold values in the configuration data structure.But User can change the values of these parameters .
References tag_qt_touch_lib_config_data_t::qt_di, tag_qt_touch_lib_config_data_t::qt_drift_hold_time, tag_qt_touch_lib_config_data_t::qt_max_on_duration, tag_qt_touch_lib_config_data_t::qt_neg_drift_rate, tag_qt_touch_lib_config_data_t::qt_pos_drift_rate, tag_qt_touch_lib_config_data_t::qt_pos_recal_delay, and tag_qt_touch_lib_config_data_t::qt_recal_threshold.
Referenced by main().
volatile uint16_t current_time_ms_touch = 0u |
Current time, set by timer ISR.
Referenced by example_cca_interrupt_callback(), and main().
unsigned int gMsTimeout |
Referenced by example_cca_interrupt_callback().
qt_touch_lib_measure_data_t* pqt_measure_data = &qt_measure_data |
qt_touch_lib_config_data_t qt_config_data |
qt_touch_lib_measure_data_t qt_measure_data |
Referenced by Transmit_Ref(), Transmit_Signals(), and Transmit_State().
|
static |
Flag set by timer ISR when it's time to measure touch.
Referenced by example_cca_interrupt_callback(), and main().
uint16_t timestamp1_hword |
Time stamp information.
Referenced by main(), and Transmit_Time_Stamps().
uint16_t timestamp1_lword |
Referenced by main(), and Transmit_Time_Stamps().
uint16_t timestamp2_hword |
Referenced by main(), and Transmit_Time_Stamps().
uint16_t timestamp2_lword |
Referenced by main(), and Transmit_Time_Stamps().
uint16_t timestamp3_hword |
Referenced by main(), and Transmit_Time_Stamps().
uint16_t timestamp3_lword |
Referenced by main(), and Transmit_Time_Stamps().