Skip to content

Conversation

@tannewt
Copy link
Member

@tannewt tannewt commented Dec 3, 2025

You cannot instantiate zephyr_i2c.I2C() because they are fixed by the board's device tree. All busses with status = "okay" are added to board with all of their labels as names. So, I2C() may be the same as I2C1() and ARDUINO_I2C().

Part of #9903.

You cannot instantiate `zephyr_i2c.I2C()` because they are fixed
by the board's device tree. All busses with status = "okay" are
added to board with all of their labels as names. So, I2C() may be
the same as I2C1() and ARDUINO_I2C().

Part of micropython#9903.
@tannewt tannewt requested a review from dhalbert December 4, 2025 17:51
@tannewt tannewt marked this pull request as ready for review December 4, 2025 17:51
dhalbert
dhalbert previously approved these changes Dec 6, 2025
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good to me, but did not test.

It's too bad there's so much duplicated code and documentation. If the documentation is largely the same for busio.I2C, I wonder if it should cross-reference that instead of copying it. The shared-binding code of busio.I2C vs zephyr_i2c.I2C also seems to be pretty much identical, or are there subtle differences? I don't see how to get around that except maybe if one macro-ified the the shared-binding source so it could be instantiated several different ways. But it's quite messy to do that in C.

//|
//| Cannot be instantiated directly. Instead singletons are created using the
//| ``board`` aliases that match the device tree labels. ``board`` may list multiple
//| aliases for a single device. For example, ``board.I2C1`` and ``board.ARDUINO_I2C``
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these have parens?

Suggested change
//| aliases for a single device. For example, ``board.I2C1`` and ``board.ARDUINO_I2C``
//| aliases for a single device. For example, ``board.I2C1()`` and ``board.ARDUINO_I2C()``

@dhalbert dhalbert dismissed their stale review December 6, 2025 03:01

meant to Request Changes

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

One possible change in doc.

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