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

Merged
merged 1 commit into from
May 23, 2024
Merged

Commits on May 18, 2024

  1. Add support for embedded-hal-async

    Now that the `embedded-hal-async` crate has released version 1.0, it
    would be nice to be able to use the async versions of `embedded-hal`'s
    traits for writing drivers for Sensirion I2C devices. This commit adds a
    new `i2c_async` module which provides versions of the APIs in the `i2c`
    module that use `embedded-hal-async`'s async `I2c` trait rather than
    `embedded-hal`'s blocking `I2c' trait.
    
    The new module is feature-flagged, so that users who don't need
    `embedded-hal-async` support can avoid the additional dependency, and
    it's off by default. Ideally, it would be nice if the blocking
    `embedded-hal` APIs could also be feature-flagged, so that async-only
    users don't have to pull them in, but that would be a breaking change.
    I've also taken the liberty of adding support for the `doc_cfg` and
    `doc_auto_cfg` RustDoc features when building on docs.rs, so that the
    documentation displays that the new module is feature-flagged.
    
    I've changed the `Error` type to require that `I:
    embedded_hal::i2c::ErrorType` rather than `I: I2c`, so that errors
    returned by `embedded_hal_async::i2c::I2c` can also be used here. This
    shouldn't be a breaking change, as far as I can tell, because `I2c` has
    a `ErrorType` bound, and all types that implement `I2c` must also
    implement `ErrorType` --- all the same types should still be valid here.
    
    Closes Sensirion#24
    hawkw committed May 18, 2024
    Configuration menu
    Copy the full SHA
    6dde55b View commit details
    Browse the repository at this point in the history