Qtouch example for SAM.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include "conf_example.h"
Macros | |
#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 | QTOUCH_LIB_COMPILER_MASK 0x01 |
Qtouch library compiler type mask. More... | |
#define | QTOUCH_LIB_COMPILER_OFFSET 2 |
Qtouch library compiler type offset: GCC / IAR. More... | |
#define | QTOUCH_LIB_KEY_ONLY_MASK 0x01 |
Qtouch library supports keys only mask. More... | |
#define | QTOUCH_LIB_KEY_ONLY_OFFSET 10 |
Qtouch library supports keys only offset. More... | |
#define | QTOUCH_LIB_MAX_CHANNEL_MASK 0x7F |
Qtouch library maximum channels mask. More... | |
#define | QTOUCH_LIB_MAX_CHANNEL_OFFSET 3 |
Qtouch library maximum channels offset. More... | |
#define | QTOUCH_LIB_ROTOR_NUM_MASK 0x1F |
Qtouch library maximum rotors/silders mask. More... | |
#define | QTOUCH_LIB_ROTOR_NUM_OFFSET 11 |
Qtouch library maximum rotors/silders offset. More... | |
#define | QTOUCH_LIB_TPYE_MASK 0x01 |
Qtouch library type: Qtouch / QMatrix. More... | |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
Functions | |
static void | config_sensors (void) |
Configure the sensors. More... | |
static void | configure_console (void) |
Configure UART console. More... | |
static void | init_system (void) |
initialise pins, watchdog, etc. More... | |
static void | init_timer_isr (void) |
Configure timer ISR to fire regularly. More... | |
int | main (void) |
Main code entry point. More... | |
static void | qt_set_parameters (void) |
This will fill the default threshold values in the configuration data structure.But User can change the values of these parameters. More... | |
void | SysTick_Handler (void) |
Handler for Sytem Tick interrupt. More... | |
static void | trace_library_info (void) |
Display information about library used. More... | |
Variables | |
static volatile uint16_t | current_time_ms_touch = 0u |
uint16_t | qt_measurement_period_msec = 25u |
timer period in msec. More... | |
static volatile uint8_t | time_to_measure_touch = 0u |
#define GET_ROTOR_SLIDER_POSITION | ( | ROTOR_SLIDER_NUMBER | ) | qt_measure_data.qt_touch_status.rotor_slider_values[ROTOR_SLIDER_NUMBER] |
Referenced by main().
#define GET_SENSOR_STATE | ( | SENSOR_NUMBER | ) | (qt_measure_data.qt_touch_status.sensor_states[(SENSOR_NUMBER/8)] & (1 << (SENSOR_NUMBER % 8))) |
Referenced by main().
#define QTOUCH_LIB_COMPILER_MASK 0x01 |
Qtouch library compiler type mask.
Referenced by trace_library_info().
#define QTOUCH_LIB_COMPILER_OFFSET 2 |
Qtouch library compiler type offset: GCC / IAR.
Referenced by trace_library_info().
#define QTOUCH_LIB_KEY_ONLY_MASK 0x01 |
Qtouch library supports keys only mask.
Referenced by trace_library_info().
#define QTOUCH_LIB_KEY_ONLY_OFFSET 10 |
Qtouch library supports keys only offset.
Referenced by trace_library_info().
#define QTOUCH_LIB_MAX_CHANNEL_MASK 0x7F |
Qtouch library maximum channels mask.
Referenced by trace_library_info().
#define QTOUCH_LIB_MAX_CHANNEL_OFFSET 3 |
Qtouch library maximum channels offset.
Referenced by trace_library_info().
#define QTOUCH_LIB_ROTOR_NUM_MASK 0x1F |
Qtouch library maximum rotors/silders mask.
Referenced by trace_library_info().
#define QTOUCH_LIB_ROTOR_NUM_OFFSET 11 |
Qtouch library maximum rotors/silders offset.
Referenced by trace_library_info().
#define QTOUCH_LIB_TPYE_MASK 0x01 |
Qtouch library type: Qtouch / QMatrix.
Referenced by trace_library_info().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by init_system().
|
static |
Configure the sensors.
References AKS_GROUP_1, HYST_6_25, qt_enable_key(), and RES_8_BIT.
Referenced by main().
|
static |
Configure UART console.
References uart_rs232_options::baudrate, gpio_configure_group, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by init_system().
|
static |
initialise pins, watchdog, etc.
References configure_console(), pmc_enable_periph_clk(), STRING_HEADER, sysclk_init(), and wdt_disable().
Referenced by main().
|
static |
Configure timer ISR to fire regularly.
Configure Timer Counter 0 to generate an interrupt every 25ms.
References qt_measurement_period_msec, and sysclk_get_cpu_hz().
Referenced by main().
int main | ( | void | ) |
Main code entry point.
References config_sensors(), current_time_ms_touch, GET_ROTOR_SLIDER_POSITION, GET_SENSOR_STATE, init_system(), init_timer_isr(), qt_filter_callback, qt_init_sensing, qt_measure_sensors(), qt_reset_sensing(), qt_set_parameters(), QTLIB_BURST_AGAIN, time_to_measure_touch, and trace_library_info().
|
static |
This will fill the default threshold values in the configuration data structure.But User can change the values of these parameters.
References DEF_QT_DI, DEF_QT_DRIFT_HOLD_TIME, DEF_QT_MAX_ON_DURATION, DEF_QT_NEG_DRIFT_RATE, DEF_QT_POS_DRIFT_RATE, DEF_QT_POS_RECAL_DELAY, DEF_QT_RECAL_THRESHOLD, qt_config_data, 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().
void SysTick_Handler | ( | void | ) |
Handler for Sytem Tick interrupt.
References current_time_ms_touch, qt_measurement_period_msec, and time_to_measure_touch.
|
static |
Display information about library used.
References current_time_ms_touch, qt_lib_sig_info_t::lib_sig_lword, qt_lib_sig_info_t::library_version, qt_get_library_sig(), qt_measure_sensors(), QTOUCH_LIB_COMPILER_MASK, QTOUCH_LIB_COMPILER_OFFSET, QTOUCH_LIB_KEY_ONLY_MASK, QTOUCH_LIB_KEY_ONLY_OFFSET, QTOUCH_LIB_MAX_CHANNEL_MASK, QTOUCH_LIB_MAX_CHANNEL_OFFSET, QTOUCH_LIB_ROTOR_NUM_MASK, QTOUCH_LIB_ROTOR_NUM_OFFSET, and QTOUCH_LIB_TPYE_MASK.
Referenced by main().
|
static |
Referenced by main(), SysTick_Handler(), and trace_library_info().
|
static |
Referenced by main(), and SysTick_Handler().