Repository navigation
zephyr-cp: add the MacroPad RP2040 - #11652
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also brings in adaboot adafruit#10: RP2 boards get boot-mode retention from a per-SoC overlay instead of their layout dtsi. The settings are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pin names come from the raspberrypi port board. The partition layout, the same as the Feather RP2040, comes from adaboot. Changes from the upstream board: - The keys (gpio-keys) and encoder (gpio-qdec) nodes are disabled so keypad and rotaryio can claim their pins. - CONFIG_DISPLAY turns on the SH1106 OLED as board.DISPLAY. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/shared_bindings_matrix.py needs it for every zephyr-cp board. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
|
Tested on a MacroPad with #11649 merged in. Keypad on all 12 keys, encoder switch and rotary all work. I2C on STEMMA QT and USB serial both don't work as submitted. The upstream dts puts the Zephyr console on uart1 at GPIO20/21. Doing what the ItsyBitsy does fixes both: board.I2C() then finds a QT gamepad at 0x49, same as 10.3.1. Could you use this instead? --- a/ports/zephyr-cp/boards/adafruit/macropad_rp2040_zephyr/board.conf
+++ b/ports/zephyr-cp/boards/adafruit/macropad_rp2040_zephyr/board.conf
@@ -5,3 +5,7 @@ CONFIG_IOBROKER_PACKAGE_RP2040_QFN56=y
# Enable the SH1106 OLED via the Zephyr display subsystem
CONFIG_DISPLAY=y
+
+# No Zephyr UART console (see board.overlay), so SCL/SDA are free for I2C.
+CONFIG_UART_CONSOLE=n
+CONFIG_LOG_BACKEND_UART=n
--- a/ports/zephyr-cp/boards/adafruit/macropad_rp2040_zephyr/board.overlay
+++ b/ports/zephyr-cp/boards/adafruit/macropad_rp2040_zephyr/board.overlay
@@ -12,3 +12,19 @@
status = "disabled";
};
};
+
+/* No Zephyr console, so SCL/SDA (GPIO21/20) are free for I2C0. */
+/ {
+ chosen {
+ /delete-property/ zephyr,console;
+ /delete-property/ zephyr,shell-uart;
+ };
+};
+
+&uart1 {
+ status = "disabled";
+};
+
+&i2c0 {
+ status = "okay";
+};Also:
|
Upstream puts the Zephyr console on uart1, on GPIO20/21, which are the STEMMA QT SDA/SCL pins. Remove the console, as the nRF52840 boards do, and enable i2c0. The zephyr_i2c label makes it board.STEMMA_I2C as well as board.I2C. Co-Authored-By: Mikey Sklar <mikeysklar@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A CONSOLE=1 or DEBUG=1 build puts the Zephyr console back on uart1, on the STEMMA QT pins (TX on SDA/GPIO20, RX on SCL/GPIO21), and disables i2c0, so board.I2C() and board.STEMMA_I2C are not available. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
I2C should be fixed. I tested scanning an MSA301. If you compile with NeoPixel support is To Be Done, as we probably want to use PIO, and we need to do PIO management. Thanks for testing! |
mikeysklar
enabled auto-merge
October 22, 2026 23:31
Collaborator
|
Sounds good. Auto-merge enabled. |
mikeysklar
approved these changes
Oct 23, 2026
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.
Board definition and testing by Claude. This note by @dhalbert.
Add
adafruit_macropad_rp2040_zephyrboard.ports/raspberrypiboard.keys(gpio-keys) andencoder(gpio-qdec) nodes. These were disabled sokeypadandrotaryiocan claim their pins.CONFIG_DISPLAY=yto turn on the onboard displayboard.DISPLAY.uart1, which uses the STEMMA QT pins. The console is removed by default, as on the nRF52840 boards, andi2c0is enabled asboard.I2C()andboard.STEMMA_I2C. Thanks @mikeysklar for the patch.CONSOLE=1orDEBUG=1build puts the Zephyr console back on the STEMMA QT pins (TX on SDA, RX on SCL), withoutboard.I2C()orboard.STEMMA_I2C.Other:
board_aliases.cmakeby board name for readability.Testing
On a MacroPad:
on_next_reset(RunMode.UF2)resets intoRPI-RP2.board.DISPLAYshows the REPL and displays a simpledisplayiotest pattern.board.STEMMA_I2C()finds an MSA301 at0x26, and is the same bus asboard.I2C().CONSOLE=1, the Zephyr boot banner and log output appear on an FTDI cable connected to the STEMMA QT pins.These tests were done with #11649 (not yet merged) temporarily merged in:
rotaryiogives one count per detent.keypad.Keyson all 12 keys and on the encoder switch works as expected.