Touch drivers

August 20, 2026 · View on GitHub

Touch controller helpers for board_config.py.

Source: drivers/touch/

board_config.py contract

Target wiring (see Board peripherals — touch duck-type):

  • touch — driver object with read_points()() when up, else a sequence of (x, y[, id[, …]])
  • touch_read = touch.read_points (neutral application-facing adapter)
  • optional touch_rotation_table — maps display rotation to touch orientation

Apps pass these exports to their chosen coordinator. appdev.App exposes app.touch_dev; LVGL creates its own pointer adapter. Do not collapse multi-touch to points[0] in the board file — return the full read_points() sequence (or a sequence-preserving map).

See any working board config (e.g. wokwi_ili9341_ft6x36_esp32s3 or fbdisplay/esp32-p4-wifi6-touch-lcd-4b) for a complete example.

Installing drivers

Board packages include the touch driver when needed. Individual install:

mip.install("github:PyDevices/pydevices/drivers/touch/tt21100.py", target="./drivers/touch")
mip.install("github:PyDevices/pydevices/drivers/touch/stmpe610.py", target="./drivers/touch")
mip.install("github:PyDevices/pydevices/drivers/touch/ft6x36.py", target="./drivers/touch")

These individual driver files are installed directly from GitHub; board installers already include the drivers they require.

MicroPython drivers

FileChipTypical boards
ft6x36.pyFocalTech FT6x36ESP32-S3 dev boards, Wokwi
tt21100.pyTT21100PyPortal, FunHouse
stmpe610.pySTMPE610PiTFT FeatherWing
xpt2046.pyXPT2046Resistive SPI touch
gt911.pyGT911Many ESP32 panels
cst8xx.pyCST816/CST820Capacitive I2C
cst226.pyCST226Capacitive I2C
chsc6x.pyCHSC6xCapacitive I2C

CircuitPython shims

Adafruit touch libraries vendored under drivers/touch/circuitpython/:

FileChip
adafruit_focaltouch.pyFocalTech FT6x36 family
adafruit_ft5336.pyFT5336
adafruit_tsc2007.pyTSC2007 resistive
adafruit_tt21100.pyTT21100 (PyPortal)
adafruit_stmpe610.pySTMPE610 (PiTFT)
adafruit_touchscreen.py4-wire analog resistive

The authoritative list is the source tree itself: drivers/touch/.

Calibration (STMPE610 / PiTFT)

PiTFT FeatherWing configs pass Adafruit's factory calibration for the 2.4" wing (rotation 90°):

_PITFT_CALIBRATION = ((357, 3812), (390, 3555))

MicroPython (pitft_ili9341_featherwing) passes this to STMPE610(..., calibration=...). CircuitPython (cp/busdisplay/spi/pitft_ili9341_featherwing) passes the same tuple to Adafruit_STMPE610_SPI.