diff options
| author | Will Sowerbutts <will@sowerbutts.com> | 2021-02-14 16:34:26 +0000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-08-04 13:52:15 +1000 |
| commit | a3675294ae39a724aec6959238c45af0dea92f21 (patch) | |
| tree | e4b93aba414a8ddbc889f59a20a98af56bf190e1 /docs/library/machine.UART.rst | |
| parent | 71722c84ca43c0f80db74d3f89e036982083a163 (diff) | |
esp32/machine_uart: Add flow kw-arg to enable hardware flow control.
This enables optional support for the hardware UART to use the RTS and/or
CTS pins for flow control.
The new "flow" constructor keyword specifies a bitmask of RTS and/or CTS.
This matches the interface used by machine.UART on stm32 and rp2.
Previously on ESP32 it was possible to specify which pins to use for the
RTS and CTS signals, but hardware flow control was never functional: CTS
was not checked before transmitting bytes, and RTS was always driven high
(signalling no buffer space available). With this patch, CTS and RTS both
operate as expected.
This also includes an update to the machine.UART documentation.
Signed-off-by: Will Sowerbutts <will@sowerbutts.com>
Diffstat (limited to 'docs/library/machine.UART.rst')
| -rw-r--r-- | docs/library/machine.UART.rst | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/library/machine.UART.rst b/docs/library/machine.UART.rst index 957d58ca1..2eb2e20cb 100644 --- a/docs/library/machine.UART.rst +++ b/docs/library/machine.UART.rst @@ -56,11 +56,22 @@ Methods - *tx* specifies the TX pin to use. - *rx* specifies the RX pin to use. + - *rts* specifies the RTS (output) pin to use for hardware receive flow control. + - *cts* specifies the CTS (input) pin to use for hardware transmit flow control. - *txbuf* specifies the length in characters of the TX buffer. - *rxbuf* specifies the length in characters of the RX buffer. - *timeout* specifies the time to wait for the first character (in ms). - *timeout_char* specifies the time to wait between characters (in ms). - *invert* specifies which lines to invert. + - *flow* specifies which hardware flow control signals to use. The value + is a bitmask. + + - ``0`` will ignore hardware flow control signals. + - ``UART.RTS`` will enable receive flow control by using the RTS output pin to + signal if the receive FIFO has sufficient space to accept more data. + - ``UART.CTS`` will enable transmit flow control by pausing transmission when the + CTS input pin signals that the receiver is running low on buffer space. + - ``UART.RTS | UART.CTS`` will enable both, for full hardware flow control. On the WiPy only the following keyword-only parameter is supported: |
