General Application Programming Interfaces (APIs)

Last modified by Microchip on 2026/02/10 14:27

DO_NOT_REMOVE

The Application Programming Interfaces (APIs) defined in these sections are typically found in all touch projects and are applicable to most devices.

touch_init

void touch_init(void)

Description: Initializes various touch library modules and other peripherals like the timer, etc. This function should be called during the initialization phase, typically before the main while(1) loop.

Parameters: None

Return: None

touch_process

void touch_process(void)

Description: This function monitors various flags used in the touch.c file and calls touch library APIs accordingly. This is a scheduler for all touch-related API calls. When the timer gives a periodic interrupt, this function starts the touch measurement. When the touch measurement is completed, post-processing APIs are also called in this function. This function should be called as frequently as possible.

In a typical application, this can be called in the main while(1) loop without any additional checks. In RTOS-based applications, this can be called in a task that is executed at a shorter interval or when an interrupt occurs (either due to the timer or due to touch measurement hardware, Peripheral Touch Controller (PTC),  Hardware Capacitive Voltage Divider (HCVD)). Any delay in calling this function can affect response time.

Parameters: None

Return: None

Back to Top

qtm_measure_complete_callback

void qtm_measure_complete_callback(void)

Description: This is the callback function passed to the qtm_ptc_start_measurement_seq() API. When the touch measurement is completed, this function will be called. In this function, the post-processing flag is set, which will be checked in touch_process().

Parameters: None

Return: None

Back to Top

touch_timer_config

void touch_timer_config(void)

Description: This function configures the timer (typically Real-Time Clock (RTC)) to give a periodic interrupt to perform touch measurement.

Parameters: None

Return: None

Back to Top

touch_timer_handler

void touch_timer_handler(void)

Description: This function typically serves as a callback from the RTC Handler. It sets a flag to initiate touch measurement and is also responsible for calling qtm_update_qtlib_timer() and qtm_update_gesture_2d_timer().

Various other application-level timings (like low-power timeout) are also updated in this function.

 

Back to Top