bme280-rs icon indicating copy to clipboard operation
bme280-rs copied to clipboard

Update to embedded-hal 1.0.0-alpha.8 and add optional support for embedded-hal-async

Open quentinmit opened this issue 1 year ago • 5 comments

Note that the example won't compile until https://github.com/stm32-rs/stm32f4xx-hal/pull/510 is merged, since they use stm32f4xx-hal and it's currently on 1.0.0-alpha.7 (not that it seemingly compiles out of the box, anyway). Not sure what to do before that's merged (block merging this, I guess?).

quentinmit avatar Aug 08 '22 08:08 quentinmit

Thank you for this. I think i will wait for the next release of the stm32f4xx-hal before merging this. Could you please provide an example for the async code usage?

VersBinarii avatar Aug 21 '22 07:08 VersBinarii

Thank you for this. I think i will wait for the next release of the stm32f4xx-hal before merging this. Could you please provide an example for the async code usage?

Hm, stm32f4xx-hal doesn't implement the embedded-hal-async traits yet. What HAL should I write an example against? The most popular async HAL for stm32 would be embassy-stm32, but that's still fairly unstable (and would require a pinned crate patch). Or would you prefer an example that doesn't actually compile? (Other than adding some .await calls, the async code would be identical, anyway.)

quentinmit avatar Aug 22 '22 15:08 quentinmit

Yes, exactly, async with embedded is quite new. TBH the only embedded async executor i'm aware of is embassy but i know nothing more about it beyond that. So i guess i was asking in this convoluted way if you could whip out some quick example of how to use the async stuff with whatever is currently out there. I was just wondering what you would use the async version of this crate for yourself 😀. But dont worry about it if its too much hassle 😉

VersBinarii avatar Aug 22 '22 21:08 VersBinarii

Yes, exactly, async with embedded is quite new. TBH the only embedded async executor i'm aware of is embassy but i know nothing more about it beyond that. So i guess i was asking in this convoluted way if you could whip out some quick example of how to use the async stuff with whatever is currently out there. I was just wondering what you would use the async version of this crate for yourself 😀. But dont worry about it if its too much hassle 😉

If that's all you're looking for you're welcome to look at the code I already wrote using it :)

https://github.com/quentinmit/discobike/blob/main/discobiker/src/actors/barometer.rs

I've been rewriting the code for my bike in Rust... yes, I know it's ridiculous to have 5kloc and counting for some LEDs... :)

quentinmit avatar Aug 23 '22 04:08 quentinmit

Thanks for the link. I have been meaning to try out embassy for some time. Cheers 👍🏻

yes, I know it's ridiculous to have 5kloc and counting for some LEDs... :)

A sure, you gotta do what you gotta do 😉 . I used to pimp my wheels with he "phantom texts" running on the 8bit PIC chips. Tons of fun 😄

VersBinarii avatar Aug 23 '22 21:08 VersBinarii