-
Notifications
You must be signed in to change notification settings - Fork 208
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
Rework i2c #2437
Rework i2c #2437
Conversation
This commit is a bit of an experimental idea, I'd love to hear feedback on it! |
a9ffb92
to
9581054
Compare
I wonder which commit that was since the link goes nowhere now |
|
I like the I also like the idea of pulling eh impls into separate (quite small) files |
We don't need to split apart every other driver and we can only extract the differing bits as well. There is enough overlapping code to make this scheme somewhat awkward although I'm biased towards liking the idea. |
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.
I think for I2C, given the wild differences between chips, this version file structure makes sense. I think it's unlikely that we'll adopt this for any other driver (unless I'm missing one, AFAIK the rest of the drivers are similar enough between chips) until new chips come out that warrant the change.
@@ -97,12 +99,129 @@ The `with_timeout` constructors have been removed in favour of `set_timeout` or | |||
+let i2c = I2c::new(peripherals.I2C0, io.pins.gpio4, io.pins.gpio5, 100.kHz()).with_timeout(timeout); | |||
``` | |||
|
|||
## Changes to half-duplex SPI | |||
### I2C drivers can now be configured using `i2c::master::Config` |
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.
This diff looks quite goofy, but I'm trusting that you've just been rearranging some things and that it is correct.
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.
Yeah I'm not that confident (I mean the changes are OK, the reason behind them is shaky). I couldn't decide how to organize things, and I think per-peripheral is better than per-topic (e.g. config changes, constructor changes, etc.).
This should be split into multiple PRs IMO, it's essentially impossible to review something of this size in any meaningful way. |
I can send in each commit separately if that helps. |
doc(hidden)
trait methodsapply_config
,with_sda/scl
embassy_embedded_hal::SetConfig
i2c::master
so we don't have to move it when introducing slavetransaction
now chunks reads and writescc #2416 and closes #1919