QTouch component task for the FreeRTOS Web/DSP Demo.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | QT_SLIDER_MAX ((0x01 << (8 - QT_SLIDER_RESOLUTION)) - 1) |
#define | QT_SLIDER_RESOLUTION QT_SLIDER_RESOLUTION_8_BIT |
Functions | |
void | create_qtouch_task (uint16_t stack_depth_words, unsigned portBASE_TYPE task_priority) |
Create the QTouch task. More... | |
static void | demo_process_qt_status (struct qt_status *qt_status) |
Process Qtouch status. More... | |
static void | demo_set_qt_param (struct qt_setup_block *psetup_block) |
Set QTouch parameter for the demo. More... | |
static void | init_interface (void) |
Initialize TWI communication interface. More... | |
static void | qtouch_task (void *pvParameters) |
QTouch task core function. More... | |
Variables | |
uint32_t | g_ip_mode |
IP mode: 0 unselected, 1 static, 2 dhcp. More... | |
const portTickType | qtouch_delay = 200UL / portTICK_RATE_MS |
struct qt_status | qtstatus |
Storage for QT status. More... | |
struct qt_setup_block | setup_block |
Storage for QT setup block. More... | |
uint8_t | slider_pos = 0 |
Slider position. More... | |
#define QT_SLIDER_MAX ((0x01 << (8 - QT_SLIDER_RESOLUTION)) - 1) |
#define QT_SLIDER_RESOLUTION QT_SLIDER_RESOLUTION_8_BIT |
Referenced by demo_set_qt_param().
void create_qtouch_task | ( | uint16_t | stack_depth_words, |
unsigned portBASE_TYPE | task_priority | ||
) |
Create the QTouch task.
stack_depth_words | Task stack size in 32 bits word. |
task_priority | Task priority. |
Initialize communication interface
Reset QT device
Check communication is ready and able to read Chip ID
Infinite loop here
Read setup block
Modify setup block parameters for specific example
Write setup block
Create the task as described above.
References demo_set_qt_param(), init_interface(), NULL, qt_get_comm_ready(), qt_hardware_reset(), qt_read_setup_block(), qt_write_setup_block(), qtouch_task(), setup_block, STATUS_OK, and xTaskCreate.
Referenced by main().
|
static |
Process Qtouch status.
qt_status | Pointer to Qtouch status struct variable. |
Read setup block
Modify setup block parameters for specific example
Write setup block
Save a slider position to be used in the DSP task.
Necessary to avoid sin_buffer overflow, when position equals 0.
References demo_set_qt_param(), qt_status::general_status, QT_GENERAL_STATUS_RESET, QT_GENERAL_STATUS_SDET, qt_read_setup_block(), qt_write_setup_block(), setup_block, slider_pos, qt_status::slider_position, SLIDER_SELECTOR_NB, and SLIDER_SELECTOR_RANGE.
Referenced by qtouch_task().
|
static |
Set QTouch parameter for the demo.
setup_block | Pointer to setup block buffer. |
References qt_setup_block::gpio_direction, qt_setup_block::gpio_gpo_drive2, QT_SLIDER_RESOLUTION, qt_setup_block::slider_num_keys, and qt_setup_block::slider_resolution.
Referenced by create_qtouch_task(), and demo_process_qt_status().
|
static |
Initialize TWI communication interface.
TWI master initialization options.
100KHz for I2C speed
Initialize the TWI master driver.
References BOARD_QT_TWI_INSTANCE, twi_options::speed, and twi_master_setup().
Referenced by create_qtouch_task().
|
static |
QTouch task core function.
pvParameters | Junk parameter. |
Wait for user to read instructions.
QTouch task Loop.
Read all status bytes
Process the received data
References demo_process_qt_status(), g_ip_mode, qt_get_status(), qt_is_change_line_low(), qtouch_delay, qtstatus, UNUSED, vTaskDelay(), and WAIT_FOR_TOUCH_EVENT.
Referenced by create_qtouch_task().
uint32_t g_ip_mode |
IP mode: 0 unselected, 1 static, 2 dhcp.
const portTickType qtouch_delay = 200UL / portTICK_RATE_MS |
Referenced by qtouch_task().
struct qt_status qtstatus |
Storage for QT status.
Referenced by qtouch_task().
struct qt_setup_block setup_block |
Storage for QT setup block.
uint8_t slider_pos = 0 |
Slider position.
Slider position, used as sin_buffer table index.
Referenced by demo_process_qt_status(), and dsp_task().