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

Support for both embedded-hals (0.2.x and 1.0.0-alpha) #388

Closed
wants to merge 9 commits into from
Closed

Conversation

burrbull
Copy link
Member

@burrbull burrbull commented Nov 19, 2021

CountDown, Pwm, Watchdogs traits are not implemented for 1.0.0-alpha due to rust-embedded/embedded-hal#324

Also need help with new spi::blocking traits.

Copy link
Member

@therealprof therealprof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. This should probably be tested in CI, right?

@burrbull
Copy link
Member Author

cc @ryankurte Could you help with testing?

@burrbull burrbull marked this pull request as draft December 27, 2021 19:38
bors bot added a commit that referenced this pull request Dec 27, 2021
404: Move embedded-hal implementations to subdirs r=therealprof a=burrbull

Part of #388 

Co-authored-by: Andrey Zgarbul <[email protected]>
@burrbull burrbull force-pushed the e-hal branch 2 times, most recently from feaf1e5 to 326ae3c Compare January 9, 2022 18:59
@pdgilbert
Copy link
Contributor

(newbie question - for my own sanity I really shouldn't be here.)
I've been trying to build some examples with the e-hal branch but I think I'm missing something simple. When I look at the tree almost everything is still using embedded-hal:0.2.6 rather than embedded-hal:1.0.0-alpha.6. I see [dependencies.embedded-hal-one]. Is there something I need to specify?

@burrbull
Copy link
Member Author

burrbull commented Feb 1, 2022

This impl uses 1.0.0-alpha.6 for now.
Unfortunately different alpha versions of embedded-hal are not compatible.
So if your driver uses other alpha version, this will not help you. Just use 0.2 with compat and wait for stabilization.

@pdgilbert
Copy link
Contributor

I understand it it is just using 1.0.0-alpha.6, thus my problem with rust-radio-sx127x. That is ok, you should not spend a lot of time trying to support different alpha versions when the idea is to move past alpha. I am wondering how to force it to use 1.0.0-alpha.6 rather than embedded-hal:0.2.6? When I build examples that use only the HAL (like blink) it is using 0.2.6 not 1.0.0-alpha.6 so I cannot see how to use it to test if my code works with 1.0.0, and am not testing if 1.0.0 works.

@pdgilbert
Copy link
Contributor

I think I am slowly starting to understand. It is not just the drivers but I actually have to go through every package, even things like cortex-m and panic-semihosting and specify versions that use embedded-hal:1.0.0-alpha.6 Is that correct?

@burrbull
Copy link
Member Author

burrbull commented Feb 2, 2022

No you don't need to change cortex-m.
I tried to update rust-radio-sx127x for alpha6. See https://github.com/burrbull/rust-radio-sx127x/tree/alpha6
But it still blocked by driver-pal dependency. ryankurte/rust-driver-pal#17

Also as I can see driver-pal is testing playground and has inverse optional dependencies. Now supports only linux-embedded-hal and cp2130. So it looks like you need to add f4xx-hal::Spi to driver_pal::HalSpi first.

@ryankurte
Copy link
Contributor

Also as I can see driver-pal is testing playground and has inverse optional dependencies. Now supports only linux-embedded-hal and cp2130. So it looks like you need to add f4xx-hal::Spi to driver_pal::HalSpi first

it is very much an experiment / WIP but, sorta the opposite... the idea was to pull out all the common bounds to simplify driver implementations, then provides opt-in helpers for linux and cp2130 (HalSpi) fulfilling those bounds. it's a bit more complicated than it needs to be at this point, but, such is life with limited hours in the day.

to instantiate the radio driver you just need to call Sx127x::spi with types fulfilling the required bounds (which creates a driver-pal::Wrapper internally). in practice (except for the current conflicting e-h issues) you shouldn't need to touch driver-pal to use the driver.

@burrbull burrbull marked this pull request as ready for review February 9, 2022 04:08
@burrbull burrbull mentioned this pull request Feb 11, 2022
bors bot added a commit that referenced this pull request Feb 12, 2022
443: e-hal alpha.7 r=burrbull a=burrbull

Same as #388, but uses alpha.7

Co-authored-by: Andrey Zgarbul <[email protected]>
@burrbull burrbull closed this Feb 12, 2022
@burrbull burrbull deleted the e-hal branch August 29, 2022 15:18
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.

4 participants