Touch button driver.
Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.
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 | ) |
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 |
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.
References qt_filter_callback, qt_init_sensing, SNS_array, SNSK_array, touch_config_sensor(), touch_init_timer_isr(), and touch_set_parameters().
Referenced by main().
|
static |
Configure timer interrupts for touch measurements.
References tc_enable(), tc_get_resolution(), TC_INT_LVL_LO, tc_set_overflow_interrupt_callback(), tc_set_overflow_interrupt_level(), tc_set_resolution(), tc_write_period(), TOUCH_TC, TOUCH_TC_PERIOD_MS, and touch_timer_period_handler().
Referenced by touch_init().
bool touch_key_is_pressed | ( | void | ) |
Check if user is pressing the touch key.
true | if key is pressed. |
false | if key is not pressed. |
References current_time_ms_touch, qt_measure_sensors(), QTLIB_BURST_AGAIN, time_to_measure_touch, and TOUCH_GET_SENSOR_STATE.
Referenced by keyboard_get_key_state(), and main().
|
static |
Pass default parameters to QTouch library.
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 touch_init().
|
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().
|
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_config_data_t qt_config_data |
QTouch configuration struct.
qt_touch_lib_measure_data_t qt_measure_data |
QTouch measurement data struct.
TOUCH_DATA_T SNS_array[2][2] |
Referenced by touch_init().
TOUCH_DATA_T SNSK_array[2][2] |
Referenced by touch_init().
Flag set by timer period callback to trigger touch measurements.
Referenced by touch_key_is_pressed(), and touch_timer_period_handler().