Step 3.1: Configure Analog-to-Digital Converter (ADC) Peripheral Library (PLIB)
The Peripheral Touch Controller (PTC) acquires signals to detect a touch on the capacitive sensors. The sensor electrodes are connected to the analog front end of the PTC through the I/O pins in the device. When the PTC is enabled, it uses ADC0 exclusively for signal conversion and acquisition.
Under the left tab Resource Management (MCC), go to Device Resources and expand Libraries > Harmony > Peripherals > ADC.Click on the symbol beside ADC0 to add the ADC instance 0 (ADC0 PLIB) to the project.
Associate PTC peripheral to ADC0 peripheral by right-clicking on the yellow diamond.
As the ADC conversion output is fed to PTC peripheral, the default ADC configuration is enough to read the sensor analog inputs.
Step 3.2: Configure Touch Library - Peripheral Touch Controller (PTC)
The PTC channels output will be used by the Touch Library along with the RTC timer.
Click on the Pins tab and configure 2D Surface Pin Configuration on Surface Matrix View as shown in Figure 12.
Click on 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.
Configure Channel parameters as shown in Figure 15.
Under Parameters > 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, Max ON Duration, Scan Rate, Acquisition Frequency and Noise Handling using Frequency Hop can be modified.
Configure Sensor parameters as shown in Figure 16.
Follow the below links for more details on Surface and Gesture Configurations
Step 3.3: Configure Touch Library Input Driver
Step 3.4: Configure Configurable Custom Logic (CCL) Peripheral Library (PLIB)
The CCL PLIB is to control the Display write pin by evaluating the logical expressions using touch input channels.
In Clock Easy View, configure the Fractional Digital Phase Locked Loop 1 (FDPLL1), GLCK Generator 3 blocks as shown below to generate a 100 MHz clock.
As per the electrical characteristics of CCL, provided in the SAM D5x/E5x Family datasheet, the CCL peripheral maximum running clock frequency is 100MHz.
Open the peripheral clock configuration by clicking on the Peripheral Clock Configuration button.
Once the window is opened, scroll down to the CCL peripheral and set GCLK3 (100 MHz) as the source clock to CCL peripheral.
Select the Pin Settings tab of MCC and configure the pin number 50 (PB23) GPIO Pin as shown in Figure 30. This pin is configured as per the LCD hardware design of the SAM E51 Integrated Graphics and Touch Curiosity Evaluation kit. CCL output will be used to control the LCD Write functionality.
Table of Contents