-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fixes UART pin setting + adds CTS/RTS HW Flow Control #6272
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
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
Possible regression from #6176 . _rxPin(-1), _txPin(-1) were removed. How are the previous pin states tracked? |
@mrengineer7777 Please test the PR to check that it works as intended and let me know. The "pin tracking" will get lost only when |
@SuGlider Apologies, as this isn't my issue and I'm not an Espressif employee I won't be able to test this.
Seems reasonable. |
rxPin = rxPin < 0 ? RX2 : rxPin; | ||
txPin = txPin < 0 ? TX2 : txPin; | ||
break; | ||
#endif |
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.
always add default:
for switch statements. ESP-IDF will complain
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.
done.
cores/esp32/HardwareSerial.cpp
Outdated
HardwareSerial::HardwareSerial(int uart_nr) : _uart_nr(uart_nr), _uart(NULL), _rxBufferSize(256) {} | ||
|
||
enum { UART_NUM_0, UART_NUM_1, UART_NUM_2 }; |
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.
If this enum will be used just for the switch statement, let's use int instead
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.
It is solved now by including "driver/uart.h" that has those defines.
Fixes UART pin setting + adds CTS/RTS HW Flow Control (espressif#6272)
Summary
This PR has two components:
1- Fixes Serial.begin() in order to keep RX/TX pins the same, as previouly set, when those parameter are not used.
2 - Adds Hardware Flow Control and adds RTS/CTS pins setting
Impact
Serial will keep RX/TX pins unmodified in case of several
begin()
calls:Modified and New functions - from HardwareSerial class:
Note:
setPins()
accepts negative pin number that will keep it unmodified.Related links
This replaces PR #6176
Fixes #6185