SLAAEU1A August   2025  – September 2026 MSPM0L1306

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1 Introduction
  5. 2 LaunchPad Setup
  6. 3 Hardware Connection
  7. 4 Design Considerations
    1. 4.1 IO Selection Consideration
    2. 4.2 Measurement Method
      1. 4.2.1 Touch Detection Method
      2. 4.2.2 X-Axis and Y-Axis Measurement
  8. 5 Software Structure
    1. 5.1 Touch Detection Example
    2. 5.2 Resistive Click and Drag Detection
    3. 5.3 Pin Mode Switching
  9. 6 Steps for Execution
  10. 7 Results
    1. 7.1 Touch Detection
    2. 7.2 Click and Drag Detection
  11. 8 Summary
  12. 9 References
  13. 10Revision History

Pin Mode Switching

This section explains the pin setup for PA15 and PA16 which were used as ADC pins and GPIO pins. This is done by performing pin mode switching the two pins. The microcontroller cannot simultaneously read and drive on the same physical pins. Therefore, a dual-phase measurement approach is required.

When reading the X coordinate, the Y-axis pins are driven as the GPIO outputs to create the voltage potential and the X-axis pin (PA15) is configured as the ADC input to measure the resulting voltage through Channel 8 of the ADC. This is implemented in the readTouchX() API in the resistive_detection.c file. It is a similar implementation for reading the Y coordinate using the PA16 pin. This necessitates switching of the pins PA15 and PA16 between GPIO and ADC modes.

The touchIOReset() function converts all touch pins back to peripheral analog mode using DL_GPIO_initPeripheralAnalogFunction(). The measurement functions then call DL_GPIO_initDigitalOutput() to temporarily switch specific pins to GPIO mode. After measurement completes, pins return to analog mode for the next cycle. A settle delay is applied after pin configuration changes to maintain voltage stabilization before the ADC measurement is done.