Repository navigation
Conversation
Turn on the remaining port-neutral shared modules that other ports enable by default. Set the keypad and touchio sub-flags in EXTRA_FLAGS, since zephyr-cp does not use py/circuitpy_mpconfig.mk defaults. Alphabetize DEFAULT_MODULES. Add native_sim tests for keypad.Keys and touchio.TouchIn using GPIO input traces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code, tests and hardware testing by Claude, with review by @dhalbert. This note by @dhalbert.
shared-modulemodules on zephyr-cp:atexitcodeopkeypadkeypad_demuxlocaletouchioDEFAULT_MODULESinports/zephyr-cp/cptools/build_circuitpython.py.EXTRA_FLAGSto turn on all thekeypadfeatures:CIRCUITPY_KEYPAD_KEYS=1CIRCUITPY_KEYPAD_KEYMATRIX=1CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS=1CIRCUITPY_TOUCHIO_USE_NATIVE=0, sotouchiowill use the genericshared-moduleimplementation, which needs an external 1 MΩ pull-down (as on CPB).test_keypad.pydriveskeypad.Keyswith GPIO input traces, for both active-low and active-high keys.test_touchio.pychecks the untouched threshold, a touch simulated by holding the pin high, and theValueErrors raised when the pull resistor is missing.I didn't test
KeyMatrixon native_sim, becausegpio_emulcan't make an input pin follow an output pin. Fixing this requires changes to our fork of Zephyr, and will be done later.Testing
On hardware, with zephyr-cp builds of this branch:
keypad.Keyson all 12 keys and the encoder switch, plusrotaryio. Results matched the rp2 port, including the encoder direction.touchiowith a 1 MΩ pull-down on A5; a rotary encoder withrotaryio; and its switch read both as a 1×1keypad.KeyMatrixand askeypad.Keys.Not in this PR
The
touchiotest on the Feather also turned up what appears to be a serious off-by-one bug ingc_realloc()inpy/gc.c, which can crash any port. The Featherkeypadandrotaryiotests ran on a build that included the fix. I'll have a separate PR for the bug after further testing.