HardwareSerial::attachRts - new optional parameter to invert signal#765
Open
KurtE wants to merge 2 commits intoPaulStoffregen:masterfrom
Open
HardwareSerial::attachRts - new optional parameter to invert signal#765KurtE wants to merge 2 commits intoPaulStoffregen:masterfrom
KurtE wants to merge 2 commits intoPaulStoffregen:masterfrom
Conversation
Added parameter to attachRts that if set will invert the signals: ``` bool attachRts(uint8_t pin, bool invert_signal=false); ``` This should allow more flexability in connecting two teensy 4.x boards to each other and using the CTS/RTS between the two boards for flow control. This is in response to the thread: https://forum.pjrc.com/index.php?threads/teensy-4-0-4-1-serial1-attachcts.75899/#post-350107 Where I felt somewhat strange to require somone to have to use hardware inverters to do this.
Owner
|
I'm hoping we can avoid more true / false parameters in public APIs. Main issue is they lead to less readable user code, where you would need to look up in the documentation what the true vs false input means to understand what the program is doing. In this case, let's go with a descriptive function name like attachRtsInverted(). |
Contributor
Author
|
We can do... But Personally, I believe that this:
Is equally unreadable... Inverted from What? If we really wanted readability, we could do something like: Warning typed on fly so probably typos. And the comments above the definition should then But your call |
Contributor
Author
|
I pushed up changes to match the API name you requested... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added parameter to attachRts that if set will invert the signals:
This should allow more flexibility in connecting two teensy 4.x boards to each other and using the CTS/RTS between the two boards for flow control.
This is in response to the thread:
https://forum.pjrc.com/index.php?threads/teensy-4-0-4-1-serial1-attachcts.75899/#post-350107
Where I felt somewhat strange to require someone to have to use hardware inverters to do this.