MicroPython AXS5106L
Small, dependency-free MicroPython driver for the AXS5106L I2C capacitive touch controller. It returns raw 12-bit touch coordinates and leaves display orientation and scaling to the application.
Install with mip
Install directly from GitHub on a network-connected MicroPython board:
import mip
mip.install("github:mattytrentini/micropython-axs5106l")
Or install it from a host connected over USB:
mpremote mip install github:mattytrentini/micropython-axs5106l
Waveshare ESP32-C6-Touch-LCD-1.47
The board uses AXS5106L address 0x63 on the shared I2C bus:
| Signal | ESP32-C6 GPIO |
|---|---|
| SDA | 18 |
| SCL | 19 |
| RESET | 20 |
| INT | 21 |
Copy axs5106l.py to the board, then run
examples/waveshare_esp32_c6_touch_lcd_147.py. The example resets the
controller and prints (x, y) while the screen is touched.
from machine import I2C, Pin
from axs5106l import AXS5106L
i2c = I2C(0, sda=Pin(18), scl=Pin(19), freq=400000)
touch = AXS5106L(i2c, reset=Pin(20, Pin.OUT), int_pin=Pin(21, Pin.IN))
touch.reset()
print(touch.touch()) # (x, y), or None
touches() returns all reported contacts (up to two). touched() tests the
active-low interrupt line. sleep() writes the controller sleep command.
Protocol notes
The controller's normal 7-bit address is 0x63. The data sheet specifies a
register-address write followed by a delay of more than 45 µs before the read;
the driver implements that transaction rather than relying on a platform's
combined-memory-read behaviour. The touch frame begins at register 0x01 and
contains gesture, contact count, then 12-bit X/Y coordinates.
Test
On a host with pytest installed:
pytest -q