Skip to content
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

Add half-duplex support to HardwareSerial. #643

Open
wants to merge 1 commit into
base: master
from

Conversation

@ghent360
Copy link
Contributor

commented Sep 9, 2019

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

@fpistm fpistm added the New feature label Sep 9, 2019

@fpistm fpistm added this to In progress in STM32 core based on ST HAL via automation Sep 9, 2019

STM32 core based on ST HAL automation moved this from In progress to Needs review Sep 9, 2019

@fpistm
Copy link
Member

left a comment

Hi @ghent360
Thanks for the PR.
Some minor remarks.

cores/arduino/stm32/uart.c Outdated Show resolved Hide resolved
cores/arduino/stm32/uart.c Outdated Show resolved Hide resolved
cores/arduino/stm32/uart.c Outdated Show resolved Hide resolved
@AnHardt

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2019

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.

Could also be nice if TX_pin == RX_pin would set up half-duplex.

@fpistm

This comment has been minimized.

Copy link
Member

commented Sep 9, 2019

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.

Could also be nice if TX_pin == RX_pin would set up half-duplex.

Wit 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.

@ghent360 ghent360 force-pushed the ghent360:half-duplex branch from e2f4e05 to 7fab152 Sep 14, 2019

@ghent360 ghent360 requested a review from fpistm Sep 14, 2019

@ghent360 ghent360 force-pushed the ghent360:half-duplex branch from 7fab152 to 7b63040 Sep 14, 2019

Venelin Efremov
First version of half-duplex support.
Implement suggestions from fpistm.
Fix style issues.

@ghent360 ghent360 force-pushed the ghent360:half-duplex branch from 7b63040 to e66fb1c Sep 14, 2019

@fpistm

This comment has been minimized.

Copy link
Member

commented Sep 14, 2019

Thanks @ghent360 , I have to test it. Do you have a sketch example to test this? Else I will write one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.