Begin implementing the embedded-hal alpha traits#82
Conversation
|
Awesome! Nice we have a start on this now. With the version pinned it shouldn't cause too much pain. Just a few thoughts
Regarding examples for 1.0.x - I'm not sure we should add them now. At this point in time, it will probably just add confusion for new users and users interested in 1.0.x can probably figure things out on their own. Maybe (also to verify our implementations) we could have a separate repo for them. (But just my gut feeling) |
bjoernQ
left a comment
There was a problem hiding this comment.
LGTM - besides my previous comments - as long as we don't break v0.2 functionality I'm totally fine
Just the thing about the module name of the v0.2 prelude might be worth thinking about before merging
|
Thanks for taking a look. I considered putting this behind a feature, but decided against it as you basically control which are used by which traits are imported. I actually agree with you on the prelude thing after sleeping on it, so I'll revert the last commit and switch to that approach instead. |
5b828ee to
ba53b97
Compare
This is not exhaustive, but covers the traits which are analogous to those already implemented. It's possible for the
0.2.xand1.0.0-alpha.xreleases to co-exist, as the user can control which set of traits are imported via the prelude.This has had some minimal level of testing, but I was not very thorough. Most of the functionality is identical to what we previously had so it should all work in theory. These traits are not currently being used in any examples, just to avoid additional changes. We can decide how we want to handle this at some other point I figure.
Implemented:
embedded_hal::delay::blocking::DelayUsembedded_hal::digital::blocking::InputPinembedded_hal::digital::blocking::OutputPinembedded_hal::digital::blocking::StatefulOutputPinembedded_hal::digital::blocking::ToggleableOutputPinembedded_hal::i2c::blocking::I2cembedded_hal::serial::nb::Readembedded_hal::serial::nb::Writeembedded_hal::spi::nb::FullDuplexNot Implemented:
embedded_hal::digital::blocking::IoPinembedded_hal::serial::blocking::Writeembedded_hal::spi::blocking::SpiBusembedded_hal::spi::blocking::SpiBusFlushembedded_hal::spi::blocking::SpiBusReadembedded_hal::spi::blocking::SpiBusWriteFor compatibility reasons I've created the
esp_hal_common::spi::SpiModeenum, as we were not actually using the data encoded in the enums provided by the two versions ofembedded-haland they are obviously different types. Let me know how you feel about this, I wasn't really sure how else to accomplish this.If you feel anything is missing please let me know and I'll add it in. I'll likely deal with the unimplemented traits in a separate PR at some point.