Synergy Software Package User's Manual
Capacitive Touch v2 Framework

Capacitive Touch v2 Module Introduction

The Capacitive Touch v2 Framework uses the CTSU v2 Driver API and provides application-level APIs for scanning touch buttons, sliders, and wheels. This module is configured via the QE for Capacitive Touch.

Capacitive Touch v2 Module Features

  • Supports touch buttons (Self and Mutual), sliders, and wheels
  • Can retrieve the status of up to 64 buttons at once
  • Software and external triggering
  • Callback on scan end
  • Collects and calculates usable scan results:
    • Slider position from 0 to 100 (percent)
    • Wheel position from 0 to 359 (degrees)
  • Optional (build time) support for real-time monitoring functionality through the QE tool over UART  

Capacitive Touch v2 Module Configuration

Note
This module is configured via the QE for Capacitive Touch. For information on how to use the QE tool, once the tool is installed click Help -> Help Contents in e2 studio and search for "QE".
Multiple configurations can be defined within a single project allowing for different scan procedures or button layouts.

The following build time configurations are defined in ssp_cfg/framework/sf_touch_ctsuv2_cfg.h:

Build Time Configurations for sf_touch_ctsuv2

Configuration Options Default Description
Parameter Checking - Default (BSP)
- Enabled
- Disabled
Default (BSP) If selected code for parameter checking is included in the build.
Support for QE monitoring using UART - Enabled
- Disabled
Disabled Enable SCI_UART support for QE monitoring.

This module can be added to the Stacks tab by selecting New Stack > Framework > Input > Cap Touch Framework on sf_touch_ctsuv2.

Capacitive Touch v2 Module Interrupt Configuration

Refer to the CTSU v2 Driver section for details.

Capacitive Touch v2 Module Clock Configuration

Refer to the CTSU v2 Driver section for details.

Capacitive Touch v2 Module Pin Configuration

Refer to the CTSU v2 Driver section for details.

Capacitive Touch v2 Module Usage Notes

Capacitive Touch v2 Module Sliders and Wheels

Sliders and wheels are subject to some limitations:

  Slider Wheel
Electrode type Self capacitance only Self capacitance only
Number of electrodes 3 to 10 4 or 8
Touch position output range 0-100 0-359
Default value (no touch) 0xFFFF 0xFFFF

Capacitive Touch v2 Module Touch Judgement

Touch data is judged as touched or not-touched based on the threshold and hysteresis values determined during the QE tool tuning process. Refer to the QE for Capacitive Touch tool documentation in e2 studio Help for details on how these values are set.

rm_touch_onfreq_threshold.png
Touch/Non-touch judgement Image

Capacitive Touch v2 Module Examples

Capacitive Touch v2 Module Basic Example

This is a basic example of minimal use of the TOUCH in an application.

void touch_basic_example (void)
{
    ssp_err_t err = SSP_SUCCESS;
   
    err = SF_TOUCH_CTSU_Open(&g_touch_ctrl, &g_touch_cfg);
   
    /* Handle any errors. This function should be defined by the user. */
    handle_error(err);
    while (true)
    {
        SF_TOUCH_CTSU_ScanStart(&g_touch_ctrl);
        while (0 == g_flag)
        {
            /* Wait scan end callback */
        }
        g_flag = 0;
        err = SF_TOUCH_CTSU_DataGet(&g_touch_ctrl, &button, slider, wheel);
        if (SSP_SUCCESS == err)
        {
            /* Application specific data processing. */
        }
    }
}
 

Capacitive Touch v2 Module Multi-Mode Example

This is a optional example of using both Self-capacitance and Mutual-capacitance. Refer to the Multi Mode Example in CTSUV2 usage notes.

void touch_optional_example (void)
{
    ssp_err_t err = SSP_SUCCESS;
    err = SF_TOUCH_CTSU_Open(&g_touch_ctrl, &g_touch_cfg);
    handle_error(err);
    err = SF_TOUCH_CTSU_Open(&g_touch_ctrl_mutual, &g_touch_cfg_mutual);
    handle_error(err);
    while (true)
    {
        SF_TOUCH_CTSU_ScanStart(&g_touch_ctrl);
        while (0 == g_flag)
        {
            /* Wait scan end callback */
        }
        g_flag = 0;
        SF_TOUCH_CTSU_ScanStart(&g_touch_ctrl_mutual);
        while (0 == g_flag)
        {
            /* Wait scan end callback */
        }
        g_flag = 0;
        err = SF_TOUCH_CTSU_DataGet(&g_touch_ctrl, &button, slider, wheel);
        if (SSP_SUCCESS == err)
        {
            /* Application specific data processing. */
        }
        err = SF_TOUCH_CTSU_DataGet(&g_touch_ctrl_mutual, &button, slider, wheel);
        if (SSP_SUCCESS == err)
        {
            /* Application specific data processing. */
        }
    }
}