-
Notifications
You must be signed in to change notification settings - Fork 221
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
Rework Uart constructors, add UartTx and UartRx constuctors. #1592
Conversation
ba1bb23
to
b540ad0
Compare
In light of #1544 I wonder if we want to take the time now to always take the tx/rx pins and only make the flow control pins optional? |
b540ad0
to
94368ee
Compare
I guess having only TX or only RX is a valid use-case? |
True, but if you only passed TX for example, you can still call read_byte() which will use the default RX pin. I wonder how other HALs handle this 🤔 |
Maybe adding type-state but that gets annoying later |
So I think we should add constructors to @SergioGasquez could you make those changes? |
One final note, we could also offer a |
That would be convenient in a couple of situations - especially since the pins are different for different targets |
c1e52a7
to
eb5a7de
Compare
a6886b2
to
c3a4680
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.
Thanks! I think this is pretty close, just a couple more things :)
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.
We also need UartTx/Rx::new_async
methods I think looking at the generated documentation (sorry I missed that earlier!).
6333442
to
40e2f79
Compare
895624b
to
c5553da
Compare
c5553da
to
eb29702
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.
LGTM, thanks for working on this!
e361b76
to
cbbc56a
Compare
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
Uart
constructors now take tx and rx pins.new_with_default_pins
constructor which uses the defaults Serial/UART gpios.UartTx
and UartRx`.with_cts
,with_rts
configure_pin
s methods.Testing
Reproducer example
uart
test is failing for Xtensa devices (S2 and S3)uart
,uart_async
,uart_tx_rx
, anduart_tx_rx_async
test for H2.