Objective
This article provides information on creating a Touch Surface and Gesture project in Microchip's MPLAB® Harmony v3 platform as well as configuring surface and gesture parameters. The generated project supports MPLAB® XC32 compiler in MPLAB® X IDE.
Procedure
1
Launch Touch Configurator
Follow steps one through eight in the Generate a Touch Project with MPLAB® Harmony page to launch the Touch Configurator in the MPLAB Harmony 3 platform.
2
Add Surface Sensors
For information on Surface Sensor Design, please refer to the Guide for Surface Sensor Design.
Select the technology, click on the Surface Sensor, and configure as per sensor design.
a
Enter the Number of Horizontal Channels.
b
Enter the Number of Vertical Channels.
c
Select Gesture Type from the drop-down menu. The available options are:
- No Gestures: 1 Touch Surface module is selected without Gesture option.
- 1 Finger Gestures: 1 Touch Surface module is selected with Gesture option.
- 1 & 2 Finger Gestures: 2 Touch Surface module is selected with Gesture option.
d
Click Add.
It loads the Surface with the selected configuration and a warning will pop up asking you to enter the CPU and Peripheral default clock settings (Peripheral Touch Controller (PTC), Timer, Universal Asynchronous Receiver Transmitter (UART)).
- Click Yes to load CPU and Peripheral clock settings for optimized touch performance.
- Click No to configure CPU and Peripheral clocks manually.
If No is chosen, then configure the main and PTC clocks in the clock configuration and Non-Volatile Memory (NVM) Wait States in the Non-Volatile Memory Controller (NVMCTRL), according to the documentation available in the harmony repo\touch\doc folder.
3
Pin Selection
Click on the Pins tab.
Click on the PTC lines to re-assign the pins as per your design.
Note: The red colored PTC line indicates that the pin is already used by a Button/Slider/Wheel sensor. Re-assign the pin in the Button/Slider/Wheel pin selection page to use it for surface configuration.
4
Parameters
Channel
Select the Parameters tab.Under Channel, Channel Parameters such as Filter Levels, Digital Gain, Analog Gain, Series Resistor, Charge Share Delay (CSD) (additional cycles), Prescaler, Threshold, Hysteresis, and Sensor Adjacent Key Suppression (AKS™) Group can be modified.
Note: All keys forming a touch surface could be configured with similar threshold and hysteresis in the same AKS Group.
Sensor
Under Sensor, Sensor Parameters such as Detect Integration, Away from Touch Recal Integration Count, Away from Touch Recal Threshold, Touch Drift Rate, Away from Touch Drift Rate, Drift Hold Time, Re-burst mode and Max ON Duration can be modified.
Note: Touch response may be sluggish if Detect Integration is more than two for surface and gesture projects.
Scroll down in the same tab to change Scan Rate, Acquisition Frequency and Noise Handling using Frequency Hop.
Surface
Under Surface, Surface Parameters such as Position Resolution, Deadband Percentage, Median Filter, Infinite Impulse Response (IIR) Filter, Position Hysteresis and Minimum Contact can be modified.
Note: When gesture feature is enabled, position resolution should be less than or equal to 8-bit.
Gesture
Select the Gesture tab.
Note: All '1 Finger' or both '1 & 2 Finger' gestures are enabled based on the gesture selection during Surface Sensor creation.
To disable the Gestures after Surface Sensor creation, uncheck the ENABLE GESTURE check box.
The gesture parameters are shown below:
All the gesture time-related parameters are timed with 10 ms timer, e.g. if Tap Release Timeout is configured as 5, this means 5 x 10 = 50 ms.
Note: While configuring Tap Release Timeout, Swipe Timeout, and Tap Hold Timeout follow the rule:
Tap Release Timeout < Swipe Timeout < Tap Hold Timeout.
5
Debug
To enable the DEBUG OPTION, click on Parameters from the panel on left, then click on the Sensor tab from the list of tabs on top.
Two options are possible:
- Using 2D Touch Surface Utility
- Using Data Visualizer
a
Follow the steps given in the Guide to Connect to Microchip 2D Touch Surface Utility to visualize surface and gesture data using 2D Touch Surface Utility software.
b
Follow the steps given in Visualize Touch Data using Data Visualizer to visualize surface and button data using Data Visualizer software.
8
Generate Code
After Project Configuration, generate the code. The source and header files will be added to the project. Build the project and program the binary file to the device.