-
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
UART owned pins + reader/writer split #210
Conversation
TODO (self):
|
I don't have time to work on this for a while and I'm starting a new job in January, so I'm going to open this PR without being able to test if the CTS/RTS actually works. |
Rebased onto the latest |
Sorry it took me so long to review this one, needed to find a block of time to properly investigate + test it.
I also tested with UART1 in a loopback scenario with
And I checked with it configured for 0,1,2,3 when 12,13,14,15 were connected (just to verify that it wasn't im TX + RX are working just fine. Further notes while I'm here: I did try to clear errors but no joy. Test code is here: |
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.
Also tested with embedded-hal alpha.
Looks good to me.
@VictorKoenders would you like me to fix the merge conflicts, or will you have time to do this?
…valid UART pin configurations
Rebased onto the latest main |
The change to UartPeripheral in rp-rs#210 was a breaking change: Bump the version of the HAL and all dependent BSP crates.
This PR makes the UartPeripheral take ownership of the pins that it needs.
UartPeripheral
takes any type that implementstrait ValidUartPinout<UART: UartDevice>
. This is implemented for:(TX, RX)
(TX, RX, CTS, RTS)
Pins
struct, in which developers can hand-pick the pins they want to use.There are 4 traits that constrain the pins to the 4 functions they can have:
Tx<UART>
,Rx<UART>
,Cts<UART>
andRts<UART>
.These traits are also implemented for
()
, so each one of the fields is optional. This is desired because some boards/devices have a single-wire UART connection that can only transfer or receive, so developers can use e.g.(Gpio1, ())