Skip to content
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

Add I2C transaction api #1137

Closed
wants to merge 1 commit into from
Closed

Add I2C transaction api #1137

wants to merge 1 commit into from

Conversation

i404788
Copy link
Contributor

@i404788 i404788 commented Feb 4, 2024

Still untested at the moment but I've added eh1 and eh0.2 I2C transaction API to the I2C peripheral, this can also be used to implement proper write_read (see #848).

Some notes:

  • I'm currently not pre-filling the FIFO like is done in the perform_write
  • Command and data parts are split up because of the blocking nature of filling/emptying the FIFOs, could make it harder to debug issues but from the command API it seems like you aren't supposed to gradually load commands while it's being processed; let me know if that's a wrong assumption.
  • I've not validated that all the commands are like the I2C events contract yet
  • I've used the structure from https://github.com/stm32-rs/stm32f4xx-hal/blob/master/src/i2c.rs#L566 although it ended up very different in the implementation.

Must

  • The code compiles without errors or warnings.
  • [?] All examples work.
  • cargo fmt was run.
  • Your changes were added to the CHANGELOG.md in the proper section.
  • You updated existing examples or added examples (if applicable).
  • Added examples are checked in CI

Nice to have

  • You add a description of your work to this PR.
  • You added proper docs for your newly added features and code.

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! It would be really nice to support the transaction API.

I'm not a huge fan of the macro approach, I'd really like to avoid it unless there isn't another way.

Perhaps we should define our own Operation enum, and add From impls for the two versions of ehal?

@jessebraham
Copy link
Member

Hey @i404788, just checking in; are you able to completing this PR, or would you like us to try to find somebody to wrap it up instead?

@jessebraham
Copy link
Member

Thank you regardless for your contribution, but I am going to close this PR for now. Please feel free to revive it or open a new one if you manage to find some time to come back to this, otherwise hopefully somebody else can carry on with this work in the future.

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.

3 participants