Add half-duplex support to HardwareSerial.#643
Conversation
Could also be nice if TX_pin == RX_pin would set up half-duplex. |
With a SoftwareSerial this could be possible but with HardwareSerial there no U(S)ART RX and TX on the same pin, as far as I know. |
e2f4e05 to
7fab152
Compare
7fab152 to
7b63040
Compare
Implement suggestions from fpistm. Fix style issues.
7b63040 to
e66fb1c
Compare
|
Thanks @ghent360 , I have to test it. Do you have a sketch example to test this? Else I will write one. |
My bad, after some read some documentations this would be possible.
Currently this is not the case as by default it is set in PushPull |
fpistm
left a comment
There was a problem hiding this comment.
I will provide a PR to extend how enable half-duplex.
And a small fix when Serial is disabled.
Summary
TMC2209 and 2208 drivers use UART communication with a single wire. Enabling half-duplex support in the HardwareSerial class would enable using these drivers without wasting another pin for the RX signal.
Proposed API is to enable half-duplex mode if the RX pin on the serial port is NC. Also added a method to set the half-duplex mode explicitly.
Validation
Tested using:
https://gist.github.com/ghent360/dc2a7226919af522e4a5914da1ad5252