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

Implement embedded-io Read + Write for UartPeripheral #727

Merged
merged 3 commits into from
Dec 23, 2023

Conversation

Sympatron
Copy link
Contributor

No description provided.

@jannic
Copy link
Member

jannic commented Dec 14, 2023

Thanks for this pull request. I think this is a very useful addition.

Does enabling the embedded-io feature have any disadvantages? (Besides slightly increasing the compile time, of course. Which should be tolerable, embedded-io isn't a large library.) I wonder if it would be even better to add it unconditionally.

ithinuel

This comment was marked as outdated.

@ithinuel ithinuel self-requested a review December 14, 2023 11:50
@jannic
Copy link
Member

jannic commented Dec 14, 2023

What's the benefit of making it mandatory ?

  • simplicity (adding too many feature flags without good reason just makes the crate difficult to use)
  • test coverage
    • thanks to cargo hack --optional-deps --each-feature we actually do test that the feature itself compiles
    • but we don't test every combination (that would be --feature-powerset and can quickly become costly)

Good reasons to have feature flags include:

  • things that are causing runtime overhead people might want to avoid (eg. rom-func-cache)
  • things that are very costly to build
  • things that just don't work for everyone (eg. rom-v2-intrinsics)
  • things that are experimental (eg. eh1_0_alpha)

I don't think embedded-io falls within any of these categories. But the list is not exhaustive - am I missing something that would apply to embedded-io?

@Sympatron
Copy link
Contributor Author

GH seems to think there still is a change request...

Copy link
Member

@ithinuel ithinuel left a comment

Choose a reason for hiding this comment

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

IMHO, we should be consistent with our embedded-hal's support.

So, our default hal impl is for 0.2.7 (for now).
If we are to implement embedded-io support, then it should follow the same model as the eh1.0-rc.* (using a feature), or have it unconditionally & remove the eh1.0 feature.

Also, for consistency with eh1.0 implementation, the embedded_io::Error should be in uart::reader next to the error type's definition.

However, as far as I am concerns, those are nits so it's only an opinion that I don't hold strongly.

@ithinuel ithinuel dismissed their stale review December 14, 2023 20:41

re-reviewed already.

@jannic
Copy link
Member

jannic commented Dec 14, 2023

Regarding eh1.0, the planned release date for that is in two weeks, an I expect that we'll remove the feature flag after that.
So even for consistency, I wouldn't add a feature flag hiding the embedded-io impls, just to remove it again in two weeks.

@thejpster
Copy link
Member

I would bundle it under the eh-1.0 feature flag, to be honest, because it's effectively where the eh-0.2 serial traits went to after they were taken out of eh-1.0.

@jannic
Copy link
Member

jannic commented Dec 21, 2023

I would bundle it under the eh-1.0 feature flag, to be honest, because it's effectively where the eh-0.2 serial traits went to after they were taken out of eh-1.0.

But will we still have an eh-1.0 feature flag once eh-1.0 is released? The reason we have one now is because it's an unstable feature, not covered by stability guarantees. But once it's released, I'd prefer removing the flag entirely.

As the patch uses a released version of embedded-io, I see no reason to hide it behind a feature flag.

@thejpster
Copy link
Member

No, I expect the eh-1.0 flag to go away. I was just thinking of (eh-1.0, e-io-0.6) as a pair, which have the equivalent functionality of (eh-0.2). You could just add e-io-0.6 support right now.

@jannic jannic merged commit 9c4eea7 into rp-rs:main Dec 23, 2023
8 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.

4 participants