Overview

Firmware for the Raspberry Pi Pico that reads an XPT2046 resistive touch controller over SPI and republishes the touch as a native USB HID device, so no host driver is needed.

Core features

  • Two USB classes from one board: an HID mouse for desktops, or a HID digitizer for touchscreens
  • Driverless on every host: Linux, Windows and macOS see an ordinary input device
  • 12-bit touch reads over SPI0 at 1 MHz, mode 0
  • Calibrated coordinates mapped from raw ADC values to the panel’s screen range
  • Noise rejection: median filter, moving average, jitter threshold and a release guard
  • Optional UART telemetry on GPIO 0 at 115200 baud for calibration

In this project

ChapterWhat it covers
Source repositoryrepository link, both targets, build commands
System architectureblock diagram and the signal path
Hardwarebill of materials, pin map, SPI configuration
XPT2046 controller and calibrationreads, coordinate mapping, how to recalibrate
USB HID descriptorsmouse against digitizer, and host behaviour
Softwareboth implementations and how to choose one
Signal filtering and noise suppressionthe coordinate filter chain
PlatformIO Arduino mouse targetthe simpler of the two builds
Resultswhat each target achieves, and known figures
Diagnostics and serial debuggingUART output and troubleshooting