Skip to content

gt911: a CircuitPython driver, and CircuitPython configs get CircuitPython driver copies - #722

Merged
bdbarnett merged 1 commit into
mainfrom
cp-gt911
Nov 20, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
cp-gt911

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

On CircuitPython, the Touch-LCD-4B's board config stopped at import gt911: its package installed the MicroPython GT911 driver, which imports sleep_ms and machine. The same happened to every CircuitPython config whose driver has a CircuitPython copy under drivers/touch/circuitpython/: the Seeed Round Display configs got the MicroPython chsc6x, and the RP2040-Touch-LCD-1.28 config got no cst816 at all.

libbuild.py installers now installs a driver's CircuitPython copy when there is one (Adafruit's own libraries still come from the bundle). The new drivers/touch/circuitpython/gt911.py polls the GT911 over a busio.I2C, pulses an optional reset line, finds the controller at 0x5D or 0x14, and offers both read_points() and the touches list the four GT911 configs read. The Touch-LCD-4B's config also mirrors x, as its MicroPython config does.

libbuild.py check and installers --check pass, and so do the libbuild tests, including a new one that fails on the old generator. The board run on a Touch-LCD-4B under CircuitPython follows in a comment. The other GT911 configs (Tab5, the two i.MX RT boards) and the CHSC6X and CST816 configs aren't run on hardware here.

Fixes #721.

…uitPython driver copies

A CircuitPython board config that imported gt911, chsc6x or cst816 got the
MicroPython driver from its package.json (or nothing, for cst816), which
fails to import on CircuitPython. The installer generator now takes a
driver's copy under drivers/<kind>/circuitpython/ when there is one.

drivers/touch/circuitpython/gt911.py is new: it polls the GT911 over a
busio.I2C, pulses an optional reset line, and finds the controller at
0x5D or 0x14. The Touch-LCD-4B's config mirrors x, as its MicroPython
config does.

Fixes #721.
@bdbarnett

Copy link
Copy Markdown
Contributor Author

Run on a Touch-LCD-4B (ESP32-P4 v1.3) under CircuitPython 11.0.0-alpha.3, the cp-p4-panel image from PyDevices/omnipython-builds#579, with this branch's board_config.py and gt911.py in /lib as the package installs them. The config imports in 0.83 s; mipidsi.Bus reads back 1000000000 and 2 lanes at 720x720; the GT911 answers at 0x5D with product id 911; touch_read() polled 388 times in 8 s with nothing touching returns () every time. A touch on the glass, and the x mirror, are still to be checked by hand.

@bdbarnett
bdbarnett merged commit 7422539 into main Nov 20, 2026
4 checks passed
@bdbarnett
bdbarnett deleted the cp-gt911 branch November 20, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Touch-LCD-4B CircuitPython package installs the MicroPython gt911 driver

1 participant