eldruin / lsm303agr-rs

Platform agnostic Rust driver for the LSM303AGR ultra-compact high-performance eCompass module: ultra-low-power 3D accelerometer and 3D magnetometer
Apache License 2.0
18 stars 14 forks source link

implement embedded-hal-async traits using maybe-async-cfg #31

Closed hdoordt closed 3 months ago

hdoordt commented 3 months ago

Fixes #30

To do:

eldruin commented 3 months ago

Could you also update the MSRV to Rust 1.75.0 and add a note about it in the changelog? Then the CI should stop complaining.

hdoordt commented 3 months ago

@eldruin I'm having some trouble getting the tests to run for async. Here's my current attempt: https://github.com/hdoordt/lsm303agr-rs/commit/ded90ca154ded9da145b4c36bc31c163cf7e9759

Sadly, the attributes don't seem to work together all that well. Can you maybe have a look?

eldruin commented 3 months ago

The tests themselves in https://github.com/hdoordt/lsm303agr-rs/commit/ded90ca154ded9da145b4c36bc31c163cf7e9759 work fine for me after adding a single .await in accel_mode_and_odr.rs:297 and running cargo test --features='async' --lib. However, the doctests and example cannot be compiled due to linux-embedded-hal not supporting async. That is expected and I would not try to do anything about it. It is very interesting to be able to run async tests but honestly I would not have put the effort into it since the code is so far the same.

hdoordt commented 3 months ago

The tests themselves in hdoordt@ded90ca work fine for me after adding a single .await in accel_mode_and_odr.rs:297 and running cargo test --features='async' --lib. However, the doctests and example cannot be compiled due to linux-embedded-hal not supporting async. That is expected and I would not try to do anything about it. It is very interesting to be able to run async tests but honestly I would not have put the effort into it since the code is so far the same.

Problem is that now the sync tests don't work anymore. I'll leave the async testing out if it's all the same to you.

However, the test coverage is regressing, which makes CI fail.

hdoordt commented 3 months ago

Done and done.

Could you create a release that includes this feature to crates.io? I'd like to use the driver in a training.

eldruin commented 3 months ago

I have released this in version 1.1.0. I have also removed the microbit-example feature, since we are not running the tests with async and async is a requirement for the example. Let me know if that is a problem for you.