Skip to content

zephyr-cp: add board.STEMMA_I2C - #11640

Merged
dhalbert merged 4 commits into
adafruit:mainfrom
dhalbert:zephyr-cp-stemma-i2c
Oct 20, 2026
Merged

dhalbert merged 4 commits into
adafruit:mainfrom
dhalbert:zephyr-cp-stemma-i2c

Conversation

@dhalbert

@dhalbert dhalbert commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Note by @dhalbert. Written with Claude.

This PR was stacked on #11638, which has now merged. It needs #11638 for board.I2C() on the Feather RP2040.

Provide a mechanism for board.STEMMA_I2C on both boards where it is shared with board.I2C() and on other boards where it has its own pins. Motivated by Zephyr CLUE needing board.STEMMA_I2C. On that board, it shares pins with board.I2C().

Upstream Zephyr already marks STEMMA QT connectors with a stemma-qt-connector node, on about 26 boards. Qwiic connectors use the same binding. Zephyr also labels the bus wired to such a connector zephyr_i2c.

  • On boards that route buses with iobroker (nRF only right now): the stemma-qt-connector entry in CONNECTORS names the connector's pins STEMMA_SCL and STEMMA_SDA, and STEMMA_I2C uses those pins. So with the same pins as board.I2C(), STEMMA_I2C is the same object; with other pins, it is a second board I2C bus.
  • All-static boards: STEMMA_I2C is the instance labeled zephyr_i2c, and the same object as board.I2C() when it is the same instance.
  • The STEMMA names are listed after a pin's other names, so board.SCL still prints as board.SCL, not board.STEMMA_SCL.
  • The upstream CLUE has no connector node, so this adds one in its board.overlay, on SCL/SDA.

Testing

  • CLUE: board.STEMMA_I2C() is board.I2C(); scan finds the onboard sensors.
  • CLUE with a temporary overlay moving the connector to P0.04/P0.05: STEMMA_I2C is a second bus, usable at the same time as board.I2C() (tested before the switch to pin names; the bus layout code didn't change).
  • Feather RP2040 (all-static; upstream stemma_connector and zephyr_i2c: &i2c1): board.STEMMA_I2C() is board.I2C().
  • Feather RP2040: board.STEMMA_SCL and board.STEMMA_SDA are board.SCL and board.SDA, and all four print as board.SCL/board.SDA.
  • Ran cptools unit tests for the STEMMA pin names and the bus layout.

dhalbert and others added 2 commits October 20, 2026 11:23
A stemma-qt-connector node (upstream's binding, also used for Qwiic
connectors) marks a board's STEMMA QT connector. It adds no pin names.

- Boards that route buses with iobroker: the connector's pins decide.
  With the same pins as board.I2C(), STEMMA_I2C is the same object;
  with other pins, it is a second board I2C bus, as on the QT Py boards
  in the other ports.
- All-static boards: STEMMA_I2C is the instance labeled zephyr_i2c,
  Zephyr's label for the bus wired to such connectors, and the same
  object as board.I2C() when it is the same instance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a stemma-qt-connector node on SCL/SDA, so board.STEMMA_I2C is
board.I2C(), as in ports/nordic. The upstream board has no node for
the connector.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's minimize how much we special case this. Please merge in the other commit too. I think it's diff is still showing for me.

Comment thread ports/zephyr-cp/cptools/zephyr2cp.py Outdated
dhalbert and others added 2 commits October 20, 2026 14:40
Instead of a special case for stemma-qt-connector nodes, give the
connector a CONNECTORS entry that names its pins STEMMA_SCL and
STEMMA_SDA, and find board.STEMMA_I2C's pins by those names, like
board.I2C()'s SCL and SDA. Qwiic connectors use the same binding, so
they get the same names.

A pin prints as its first board name, so list the STEMMA names last:
board.SCL still prints as board.SCL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhalbert
dhalbert requested a review from tannewt October 20, 2026 19:11

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dhalbert
dhalbert merged commit 2a3d74e into adafruit:main Oct 20, 2026
47 checks passed
@dhalbert
dhalbert deleted the zephyr-cp-stemma-i2c branch October 20, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants