-
Notifications
You must be signed in to change notification settings - Fork 232
Add embedded-io, embedded-io-async, remove serial traits. #466
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
Conversation
fe08b3f
to
e5af237
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approach seems reasonable and examples are solid, lgtm (and thanks for your work on this)!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for all your work!
This looks great to me.
Something to do after merging this would be to document how to go about something like the older serial::Write
trait and how e-h
and e-io
fit together.
Co-authored-by: Diego Barrios Romero <[email protected]>
adressed @eldruin 's review comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you again!
It seems we are all fine with this so let's merge it.
As discussed previously and in today's meeting (chatlog, minutes), we've decided to not have serial traits, in favor of a more general "io" abstraction.
This PR moves the embedded-io crate to the embedded-hal repo. The crate currently living at https://github.com/embassy-rs/embedded-io, that repo will be archived once the move is complete.
Changes from the embassy repo:
defmt
impls, needed for 1.0.embedded-io
andembedded-io-async
. Needed for 1.0, so we don't have to wait for AFIT to be stable.tokio
andfutures
. I'm not sure if we want them here or it's better to leave them to community crates. If we do, I'll add them in a future PR.embedded-io::{ReadReady, WriteReady}
. They're separate from theRead
/Write
traits since they can't be trivially implemented on top ofstd::io
traits, so this would present a problem for the adapters. (It's likely implementable with e.g. some weirdpoll()/select()
contraption, but that's OS-specific and I'm sure has other tradeoffs, so I'd rather not make the adapters do that by default.)The crate has been added by parts in several commits to make review easier.
The
embedded-io
crate has been around for more than 1 year, so it's somewhat "proven". The design is the same asstd::io
, which is more than proven. Highlights of uses ofembedded-io
in the field (see more)embassy-nrf
DMA-powered UART implembassy-stm32
irq-driven UARTembassy-stm32
DMA-powered UARTembassy-rp
irq-driven UARTembassy-sync
Pipeembassy-net
TcpSocketembedded-tls
TLS client, uses embedded-io to work on top of any TCP socket.reqwless
HTTP client, uses embedded-io to work on top of any TCP socket or on top ofembedded-tls
.rust-mqtt
, same.embedded-svc
abstractions, widely used in the ESP32 ecosystem.embedded-nal-async
models TCP sockets asRead+Write
.es-wifi-driver
, AT commands over uartesp8266-at-driver
, AT commands over uart