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

Proposal for Configure baudrate trait #209

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

unizippro
Copy link

This trait lets the implementer choose the type for Baudrate as this is done in different ways in different crates.
Returning a result lets the implementer sort out bad, incompatible or impossible bauds, or simply return an unsupported error.
An implementation can be seen at stm32l4xx-hal/feature/change-baud/
In this implementation the clock freq is saved with the Uart struct, and the used to change the baud. If the clock frequency were to change the Uart would have to be reinitialized anyway.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @therealprof (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@timokroeger
Copy link
Contributor

Thank you for tackling this issue.
Could you please provide an example on how to use the new Trait in a generic driver?

@unizippro unizippro marked this pull request as draft May 14, 2020 08:51
@unizippro
Copy link
Author

I see now that this function should be able to be called from tx and rx. But since they don't hold any reference to registers I'll leave this as a draft for now.
A solution may be to return (tx, rx, config) from split, but i won't be investigating this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Review is incomplete T-hal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants