-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add I2C support to the Zephyr builds #10735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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.
dhalbert
left a comment
There was a problem hiding this 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`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these have parens?
| //| 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
left a comment
There was a problem hiding this 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.
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.