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

Please add support for embedded-hal-async #5

Open
quentinmit opened this issue Jul 9, 2022 · 0 comments
Open

Please add support for embedded-hal-async #5

quentinmit opened this issue Jul 9, 2022 · 0 comments

Comments

@quentinmit
Copy link

The I2c trait from embedded-hal-async would allow this crate's usage with embassy.

Unfortunately, I can only think of hacky solutions to support both blocking and async:

  • Make a second copy of all the functions, doing the rote fn -> async fn transformation and sprinkling in some .await calls
  • Macro magic to define two copies using the same source

and then another question is:

  • Keep the same type names and swap in async using a feature, or
  • Expose the methods on a different type or in a different module (still feature-gated).

I asked in rust-embedded/embedded-hal#356 if there's any best practice here. I think most of the other crates I've seen have gone for some form of duplicate code.

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

No branches or pull requests

1 participant