-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat: add an I2C controller abstraction #421
feat: add an I2C controller abstraction #421
Conversation
CI @kaspar030 Should we try to leverage laze for running clippy or is it fine to pass only the required |
Using laze would be ideal but seems like more work. I think we might nudge
Could you try that, also if it works two times in a row (later entry in GITHUB_ENV overrides previous)? |
0a8f9d8
to
6d54881
Compare
LGTM (minor last CI fixes)! |
I had to remove one of the quotes; the following works: - run: echo 'RUSTFLAGS=--cfg context="esp32c6"' >> $GITHUB_ENV |
LGTM, please squash! |
84dc9c3
to
db9ea57
Compare
Description
This PR provides an abstraction layer for I2C support, in controller mode.
It focuses on providing non-DMA-enabled drivers, which still provide an async interface, with timeouts—e.g., to avoid indefinitely blocking when the target is not connected.
The drivers implement
embedded_hal_async::i2c::I2c
, and can thus easily be used by any device driver relying on that trait.It provides ways to either select standard frequencies (100 kHz or 400 kHz) which all MCUs are expected to support, or to request the highest available frequency within a range, resolved at compile-time using
highest_freq_in
.Issues/PRs references
Depends on #422
Open Questions
Frequency
be renamed toBitrate
?Limitations
DMA-enabled drivers are out-of-scope of this PR as the number of DMA channels is limited on some architectures and non-DMA-enabled drivers are therefore useful when no channels are left. Moreover, setting up DMA incurs some overhead, and is thus not relevant for small operations as it is the case with sensors, which was the initial motivation for adding support for I2C.
Future work
dma
module insidei2c::controller
.Change checklist