On this page

Source Repository

Touch2USB holds two independent firmware implementations in one repository, because the two use cases need different USB HID classes.

ItemValue
Repositoryisarwar93/Touch2USB
Clonegit clone https://github.com/isarwar93/Touch2USB.git

Repository layout

Touch2USB/
├── pico_platformio_touch_mouse/
│   ├── platformio.ini
│   ├── include/
│   ├── src/
│   └── README.md
├── pico_sdk_touch/
│   ├── CMakeLists.txt
│   ├── main.c
│   ├── usb_descriptors.c
│   ├── usb_descriptors.h
│   ├── build/
│   └── README.md
└── README.md

The two targets

FirmwareFrameworkUSB classCoordinatesHost compatibility
pico_platformio_touch_mousePlatformIO with ArduinoHID Mouserelative deltaany OS with a generic HID mouse
pico_sdk_touchPico SDK with TinyUSBHID DigitizerabsoluteLinux evdev and LVGL, Windows, macOS

Building

# Mouse target, simplest toolchain
cd pico_platformio_touch_mouse
pio run --target upload

# Digitizer target
cd ../pico_sdk_touch
mkdir -p build && cd build
cmake .. && make

Where to look in the code

  • pico_sdk_touch/main.c holds the SPI reads, the filter chain and the HID report
  • pico_sdk_touch/usb_descriptors.c holds the digitizer descriptor, see USB HID descriptors
  • each target keeps its own copy of the calibration constants, see XPT2046 calibration