Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

usdl2 as a CircuitPython user C module (unix) - #53

Merged
bdbarnett merged 1 commit into
mainfrom
cp-phase1
Oct 8, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
cp-phase1

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

CircuitPython 11 builds user C modules through USER_C_MODULES the way MicroPython 1.29 does, so micropython.mk now builds usdl2 into CircuitPython's unix port directly:

make -C ports/unix USER_C_MODULES=/path/to/displayif
  • usdl2_mp.c registers the module under that build (DISPLAYIF_USER_C_MODULE, passed by micropython.mk). CircuitPython's unix port sets CIRCUITPY=1, so before this it skipped MP_REGISTER_MODULE.
  • On any other CircuitPython port the module stops the build with a message: boards there use CircuitPython's own displayio, and displayif's display modules aren't ported to it.
  • MicroPython builds are unchanged. apply_cp_patches.sh still works for a tree patched the older way.

Checked on CircuitPython 11.0.0-alpha.1 unix (coverage): tools/test_usdl2.py passes under SDL_VIDEODRIVER=dummy, and a real X11 window opened and drew (captured from the X server, pixels exact). A build without this module fails the same test with ImportError.

CircuitPython 11 reads USER_C_MODULES like MicroPython 1.29 does, so the
same micropython.mk builds usdl2 into its unix port with no change to
CircuitPython's own tree. usdl2_mp.c registers the module when built that
way (CIRCUITPY is 1 on CircuitPython's unix port, so it used to skip its
MP_REGISTER_MODULE). On any other CircuitPython port the module refuses to
build: boards there use CircuitPython's displayio.
@bdbarnett
bdbarnett merged commit 38acfed into main Oct 8, 2026
1 check passed
@bdbarnett
bdbarnett deleted the cp-phase1 branch October 8, 2026 08:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant