-
-
Notifications
You must be signed in to change notification settings - Fork 740
Add optional RTS + CTS support to UART #257
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
Conversation
cores/arduino/Uart.cpp
Outdated
|
|
||
| size_t Uart::write(const uint8_t data) | ||
| { | ||
| if (uc_pinRTS != NO_RTS_PIN) { |
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.
why? should RTS influence only Rx?
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.
Right, I misunderstood the RTS term - corrected!
cores/arduino/Uart.cpp
Outdated
| if (uc_pinRTS != NO_RTS_PIN) { | ||
| // if there is NOT enough space in the RX buffer, de-assert RTS | ||
| if (rxBuffer.availableForStore() < RTS_RX_THRESHOLD) { | ||
| digitalWrite(uc_pinRTS, HIGH); |
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.
digitalWrite may be slow, we should explore direct register access.
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.
I've pushed a commit to leverage SERCOM h/w capabilities.
cores/arduino/Uart.cpp
Outdated
| digitalWrite(uc_pinRTS, LOW); | ||
| } | ||
|
|
||
| if (uc_pinCTS != NO_CTS_PIN) { |
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.
mmmhhh there is no other way here? Ideally the CTS pin should mask the tx ISR, so you can always write in the buffer without blocking (until the buffer is full). What is not clear to me is if there is a way to trasparently re-enable the tx ISR.
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.
The latest commit addresses this.
|
@cmaglie there's one open question, if we expose the The other option is to pass then in the constructor. |
|
I've removed the |
8c484ba to
5344161
Compare
|
✅ Build completed. ⬇️ Build URL: ℹ️ To test this build:
|
No description provided.