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 embedded-hal-async support #7

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hawkw
Copy link
Contributor

@hawkw hawkw commented Jun 9, 2024

This commit adds support for the embedded-hal-async crate in addition
to embedded-hal. I've done this by adding a separate AsyncSht4x
type, based on the assumption that most projects won't need to use both
the blocking embedded-hal traits and the embedded-hal-async traits
at the same time, and providing async fn methods on a separate type
with the same names as the blocking ones seemed a bit nicer than having
one type that has both fn measure and async fn measure_async and so
on.

Support for embedded-hal-async is gated behind the
embedded-hal-async feature flag, so the dependency is not enabled by
default.

Note that this branch depends on my PR #6, which updates this crate to
use embedded-hal v1.0, and currently contains the commit from that
change as well. Once #6 has merged, this branch will need to be rebased
onto the main branch.

It also depends on my upstream PR adding embedded-hal-async support to
sensirion-i2c-rs, Sensirion/sensirion-i2c-rs#30, which has been
merged, but hasn't been published to crates.io yet. Currently, this
branch adds a Cargo [patch] to use a Git dep on sensirion-i2c-rs.
So, this change cannot be released to crates.io until upstream publishes
a new release of sensirion-i2c-rs. Hopefully they do that soon! :)

hawkw added 2 commits June 9, 2024 14:28
This commit updates the library to `embedded-hal` v1.0. This was,
overall, a pretty trivial update. Since this is a breaking change, I've
also updated the version number to v0.2.0.
This commit adds support for the `embedded-hal-async` crate in addition
to `embedded-hal`. I've done this by adding a separate `AsyncSht4x`
type, based on the assumption that most projects won't need to use both
the blocking `embedded-hal` traits and the `embedded-hal-async` traits
at the same time, and providing `async fn` methods on a separate type
with the same names as the blocking ones seemed a bit nicer than having
one type that has both `fn measure` and `async fn measure_async` and so
on.

Support for `embedded-hal-async` is gated behind the
`embedded-hal-async` feature flag, so the dependency is not enabled by
default.

Note that this branch depends on my PR sirhcel#6, which updates this crate to
use `embedded-hal` v1.0, and currently contains the commit from that
change as well. Once sirhcel#6 has merged, this branch will need to be rebased
onto the main branch.

It also depends on my upstream PR adding `embedded-hal-async` support to
`sensirion-i2c-rs`, Sensirion/sensirion-i2c-rs#30, which has been
[merged], but hasn't been published to crates.io yet. Currently, this
branch adds a Cargo `[patch]` to use a Git dep on `sensirion-i2c-rs`.
So, this change cannot be released to crates.io until upstream publishes
a new release of `sensirion-i2c-rs`. Hopefully they do that soon! :)

[merged]: Sensirion/sensirion-i2c-rs@f7b9f3a
@hawkw hawkw changed the title Eliza/embedded hal async Add embedded-hal-async support Jun 9, 2024
hawkw added 2 commits July 20, 2024 09:57
Now that my changes have been published upstream, we can remove the Git
patch. This PR should now be okay to merge!
This way, the naming scheme is more consistent with the async driver
I added to the `sgp30` crate. See:
dbrgn/sgp30-rs@cb769b0
@bbustin
Copy link

bbustin commented Sep 5, 2024

Please also see my pull request which added support for embedded-hal-1.0 and async support gated behind a feature: #5

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.

2 participants