-
Notifications
You must be signed in to change notification settings - Fork 23
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
Avoid breaking changes when one hal is upgraded #14
Comments
Thanks for pointing out! |
Make a new trait for each new version of the API? EG: What embedded-hal did for digital pins (the V1 and V2 traits, with a conversion trait implemented on V2) |
I came up with the following idea. |
I believe that I managed to solve this problem! |
An idea for solving this problem. I had this idea reading atsamd-rs/atsamd#11 (comment)
A trait (or a set of trait) is present in a dedicated crate that expose the low level stm32 usb api of the hardware. Each hal provide a simple constructor that create a struct that implement this trait. Then, the stm32-usbd provide a constructor that take a type implementing the trait and do the hard stuffs.
Breaking changes in the hal is then transparent to stm32-usbd, it's only coupled with the crate describing the trait. This trait, as a trivial proxy of the hardware, should be stable (as the
-sys
crates).I have no idea of the implementation of this crate, so I may tell something not doable, but in case it's working, I share the idea.
The text was updated successfully, but these errors were encountered: