drv_touch_xpt2046
SPI resistive touch driver for the XPT2046 ADC. Extensively fixed during review for pressure, sampling, and debounce.
Overview Fixed
| HAL Type | Input |
| Chip | XPT2046 |
| Interface | SPI |
| Description | Resistive touch with pressure detection, outlier rejection, and debounce filtering. |
Implementation
| Source | components/kernel_rs/src/drv_touch_xpt2046.rs (1514 lines) |
| Wraps | None — manual SPI ADC reads |
| Tests | 31 unit tests |
Devices
Boards that use this driver:
| Device | Status |
|---|---|
| CYD S028 | Fixed |
Configuration
Configured via board.json: SPI pins (MOSI, MISO, CLK, CS), pin_irq for touch interrupt.
Known Issues
Fixed: Z1+Z2 pressure formula per datasheet, IRQ masking in control byte, interleaved X/Y sampling, median-of-3 outlier rejection, 50ms debounce.