Skip to content



The touch feature requires a screen with a touch controller and the PDLS_EXT3_Advanced_Touch library.


Ensure the configuration file enables touch


and defines the required pins touchReset and touchInt.

    .touchInt = 8, ///< EXT3-Touch pin 3 Red -> GPIO8
    .touchReset = 6, ///< EXT3-Touch pin 4 Orange -> GPIO6


if (myScreen.getTouchInterrupt())
    bool result;
    uint16_t x, y, z, t;

    result = myScreen.getTouch(x, y, z, t);

getTouchInterrupt() returns true if the touch controller has raised an interrupt.

getTouch() returns true if an event has been raised, and populates

  • x: x coordinate, according to orientation;

  • y: y coordinate, according to orientation;

  • z: pressure, if the touch controller manages it;

  • t: event, if the touch controller manages it.

There are four events: none, press, release and move.


The scopes of the interrupt and the events may differ. The touch controller generates the interrupt while the library manages the events.

For example, the touch controller raises an interrupt for the press and move events, but not for the release event.

The touch controller offers two optimised power modes, one automatic and another manual.

The automatic mode is managed by the touch controller. The controller enters stand-by mode after a period of inactivity and exits it when the panel is touched. The GPIOs for the touch interrupt are not affected as they are required to manage the reset and trigger the wake-up event.

The manual mode is managed by the system with two functions to enter and exit deep sleep.

  • The function suspendTouch() turns the touch controller off and deactivates the I²C bus.

  • The function resumeTouch() resets the touch controllers and reactivates the I²C bus.


The functions suspendTouch() and resumeTouch() should not be used if other devices share the same I²C bus.


This is the core of the code from example Touch_Draw.ino.

void displayTouchDraw()
    uint16_t x, y, z, t;
    uint16_t x0, y0, z0, t0; // previous
    uint16_t count = 0;
    bool result;


    while (count < 64)
        result = myScreen.getTouch(x, y, z, t);

        if ((t == TOUCH_EVENT_MOVE) or (t0 == TOUCH_EVENT_RELEASE))
            if ((t0 == TOUCH_EVENT_PRESS) or (t0 == TOUCH_EVENT_MOVE))
                myScreen.line(x0, y0, x, y,;
                count += 1;

        x0 = x;
        y0 = y;
        t0 = t;