QTouch implementation for SAM toolkit demo.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
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))) |
Get QTouch state. More... | |
#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 | TOTAL_SLIDER_NUM 2 |
Total slider number supported. More... | |
Enumerations | |
enum | main_screen_icon_id { MAIN_SCR_AUDIO_ID = 0, MAIN_SCR_FFT_ID, MAIN_SCR_PPT_ID, MAIN_SCR_SETTINGS_ID, MAIN_SCR_QTOUCH_ID, MAIN_SCR_LPM_ID, MAIN_SCR_DUMMY_LEFT_ID, MAIN_SCR_INFO_ID, MAIN_SCR_DUMMY_RIGHT_ID, MAIN_SCR_MAX_ID } |
Main screen IDs. More... | |
Functions | |
static void | config_sensors (void) |
Configure the sensors. More... | |
void | demo_qt_init (void) |
Initialize QTouch. More... | |
void | demo_qtouch_event_handler (void) |
QTouch event handler. 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... | |
Variables | |
uint16_t | current_time_ms_touch = 0u |
Current time, set by timer ISR. More... | |
static enum main_screen_icon_id | demo_last_selected_icon_id = MAIN_SCR_INFO_ID |
static enum main_screen_icon_id | demo_selected_icon_id = MAIN_SCR_INFO_ID |
Selected icon ID; default is set to info icon. More... | |
static uint8_t | dwn_pressed = 0 |
QTouch down key pressed. More... | |
static uint8_t | lft_pressed = 0 |
QTouch left key pressed. More... | |
uint16_t | qt_measurement_period_msec = 25u |
Timer period in msec. More... | |
static uint8_t | rgt_pressed = 0 |
QTouch right key pressed. More... | |
uint8_t | time_to_measure_touch = 0u |
Flag set by timer ISR when it's time to measure touch. More... | |
static uint8_t | up_pressed = 0 |
QTouch up key pressed. More... | |
static uint8_t | vld_pressed = 0 |
QTouch enter key pressed. More... | |
static struct gfx_bitmap | win_qtouch_btn_down_icon |
Bitmap for QTouch down button. More... | |
static struct gfx_bitmap | win_qtouch_btn_down_press_icon |
Bitmap for QTouch pressed down button. More... | |
static struct gfx_bitmap | win_qtouch_btn_enter_icon |
Bitmap for QTouch selected button. More... | |
static struct gfx_bitmap | win_qtouch_btn_enter_press_icon |
Bitmap for QTouch pressed selected button. More... | |
static struct gfx_bitmap | win_qtouch_btn_next_icon |
Bitmap for QTouch right button. More... | |
static struct gfx_bitmap | win_qtouch_btn_next_press_icon |
Bitmap for QTouch pressed right button. More... | |
static struct gfx_bitmap | win_qtouch_btn_prev_icon |
Bitmap for QTouch left button. More... | |
static struct gfx_bitmap | win_qtouch_btn_prev_press_icon |
Bitmap for QTouch pressed left button. More... | |
static struct gfx_bitmap | win_qtouch_btn_up_icon |
Bitmap for QTouch up button. More... | |
static struct gfx_bitmap | win_qtouch_btn_up_press_icon |
Bitmap for QTouch pressed up button. More... | |
#define GET_ROTOR_SLIDER_POSITION | ( | ROTOR_SLIDER_NUMBER | ) | qt_measure_data.qt_touch_status.rotor_slider_values[ROTOR_SLIDER_NUMBER] |
Referenced by demo_qtouch_event_handler().
#define GET_SENSOR_STATE | ( | SENSOR_NUMBER | ) | (qt_measure_data.qt_touch_status.sensor_states[(SENSOR_NUMBER / 8)] & (1 << (SENSOR_NUMBER % 8))) |
Get QTouch state.
Referenced by demo_qtouch_event_handler().
#define QTOUCH_LIB_COMPILER_MASK 0x01 |
QTouch library compiler type mask.
#define QTOUCH_LIB_COMPILER_OFFSET 2 |
QTouch library compiler type offset: GCC / IAR.
#define QTOUCH_LIB_KEY_ONLY_MASK 0x01 |
QTouch library supports keys only mask.
#define QTOUCH_LIB_KEY_ONLY_OFFSET 10 |
QTouch library supports keys only offset.
#define QTOUCH_LIB_MAX_CHANNEL_MASK 0x7F |
QTouch library maximum channels mask.
#define QTOUCH_LIB_MAX_CHANNEL_OFFSET 3 |
QTouch library maximum channels offset.
#define QTOUCH_LIB_ROTOR_NUM_MASK 0x1F |
QTouch library maximum rotors/silders mask.
#define QTOUCH_LIB_ROTOR_NUM_OFFSET 11 |
QTouch library maximum rotors/silders offset.
#define QTOUCH_LIB_TPYE_MASK 0x01 |
QTouch library type: QTouch / QMatrix.
#define TOTAL_SLIDER_NUM 2 |
Total slider number supported.
enum main_screen_icon_id |
Main screen IDs.
The screen ID is used to selecte the specific icon widget through the QTouch event.
|
static |
Configure the sensors.
References AKS_GROUP_1, BOARD_DOWN_KEY_CHANNEL, BOARD_LEFT_KEY_CHANNEL, BOARD_RIGHT_KEY_CHANNEL, BOARD_SLIDER_END_CHANNEL, BOARD_SLIDER_START_CHANNEL, BOARD_UP_KEY_CHANNEL, BOARD_VALID_KEY_CHANNEL, HYST_6_25, qt_enable_key(), and RES_8_BIT.
Referenced by demo_qt_init().
void demo_qt_init | ( | void | ) |
Initialize QTouch.
References config_sensors(), qt_filter_callback, qt_init_sensing, qt_reset_sensing(), and qt_set_parameters().
Referenced by main().
void demo_qtouch_event_handler | ( | void | ) |
QTouch event handler.
The QTouch event is valid at main window and QTouch application window.
References BOARD_DOWN_KEY_ID, BOARD_LEFT_KEY_ID, BOARD_RIGHT_KEY_ID, BOARD_UP_KEY_ID, BOARD_VALID_KEY_ID, win_pointer_event::buttons, current_time_ms_touch, demo_get_special_mode_status(), demo_last_selected_icon_id, DEMO_MAIN_MODE, DEMO_QTOUCH_MODE, demo_selected_icon_id, dwn_pressed, GET_ROTOR_SLIDER_POSITION, GET_SENSOR_STATE, GFX_COLOR, gfx_draw_bitmap(), gfx_draw_filled_rect, gfx_draw_rect, gfx_generic_draw_rect(), win_pointer_event::is_relative, lft_pressed, MAIN_SCR_AUDIO_ID, MAIN_SCR_DUMMY_LEFT_ID, MAIN_SCR_DUMMY_RIGHT_ID, MAIN_SCR_FFT_ID, MAIN_SCR_INFO_ID, MAIN_SCR_MAX_ID, win_pointer_event::pos, qt_measure_sensors(), QTLIB_BURST_AGAIN, rgt_pressed, time_to_measure_touch, win_pointer_event::type, up_pressed, vld_pressed, WIN_POINTER_PRESS, WIN_POINTER_RELEASE, win_queue_pointer_event(), WIN_TOUCH_BUTTON, win_point::x, and win_point::y.
Referenced by task_win().
|
static |
This will fill the default threshold values in the configuration data structure.But User can change the values of these parameters.
References 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 demo_qt_init().
uint16_t current_time_ms_touch = 0u |
Current time, set by timer ISR.
Referenced by demo_qtouch_event_handler(), and SysTick_Handler().
|
static |
Referenced by demo_qtouch_event_handler().
|
static |
Selected icon ID; default is set to info icon.
Referenced by demo_qtouch_event_handler().
|
static |
QTouch down key pressed.
Referenced by demo_qtouch_event_handler().
|
static |
QTouch left key pressed.
Referenced by demo_qtouch_event_handler().
|
static |
QTouch right key pressed.
Referenced by demo_qtouch_event_handler().
uint8_t time_to_measure_touch = 0u |
Flag set by timer ISR when it's time to measure touch.
Referenced by demo_qtouch_event_handler(), and SysTick_Handler().
|
static |
QTouch up key pressed.
Referenced by demo_qtouch_event_handler().
|
static |
QTouch enter key pressed.
Referenced by demo_qtouch_event_handler().
|
static |
Bitmap for QTouch down button.
|
static |
Bitmap for QTouch pressed down button.
|
static |
Bitmap for QTouch selected button.
|
static |
Bitmap for QTouch pressed selected button.
|
static |
Bitmap for QTouch right button.
|
static |
Bitmap for QTouch pressed right button.
|
static |
Bitmap for QTouch left button.
|
static |
Bitmap for QTouch pressed left button.
|
static |
Bitmap for QTouch up button.
|
static |
Bitmap for QTouch pressed up button.