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

Add trait embedded_io_async to uarte #3646

Merged
merged 2 commits into from
Dec 15, 2024

Conversation

wackazong
Copy link
Contributor

No description provided.

@Dirbaio
Copy link
Member

Dirbaio commented Dec 14, 2024

The raw Uart can't impl embedded_io::Read for a few reasons:

  • It is is unbuffered, this means it can only receive while the task is actively waiting on a .read().await call. Data that's received between read calls is lost. The embedded_io::Read contract requires that data is not so easily lost, drivers using it can assume that.
  • It must return early if less than buf.len() bytes are received. Drivers can call read() with a buffer bigger than the data they're expecting (for example, if they don't know the size of the data in advance) and get back a partially filled buffer with the data that arrived and process that. With this impl, they'd hang instead.

for embedded_io::Read there's the buffered uart which does extra fancy things to fulill the embedded-io contract.

Could you add just the Write impls?

@wackazong
Copy link
Contributor Author

Thanks for the explanation. I changed it as requested.

@Dirbaio Dirbaio added this pull request to the merge queue Dec 15, 2024
Merged via the queue into embassy-rs:main with commit 1e37cc5 Dec 15, 2024
7 checks passed
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.

2 participants