diff options
author | Jason Neal <jason.neal@astro.up.pt> | 2020-01-05 01:28:12 +1300 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-01-06 22:50:58 +1100 |
commit | 5ef3b6b2d9aa60febe545d6f12a5d1b7300739ce (patch) | |
tree | 180387928f20ade4bf5fdabe687f9c61f4f7b4b9 | |
parent | 99ed431d2840b30f67eae49be96d31c7faeca75e (diff) |
docs/library/machine.UART.rst: Detail timeout behaviour of read methods.
Also document existence of "invert" argument to constructor.
-rw-r--r-- | docs/library/machine.UART.rst | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/docs/library/machine.UART.rst b/docs/library/machine.UART.rst index 5fcdc2758..70984dfb2 100644 --- a/docs/library/machine.UART.rst +++ b/docs/library/machine.UART.rst @@ -58,6 +58,9 @@ Methods - *rx* specifies the RX pin to use. - *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. On the WiPy only the following keyword-only parameter is supported: @@ -87,7 +90,8 @@ Methods .. method:: UART.read([nbytes]) Read characters. If ``nbytes`` is specified then read at most that many bytes, - otherwise read as much data as possible. + otherwise read as much data as possible. It may return sooner if a timeout + is reached. The timeout is configurable in the constructor. Return value: a bytes object containing the bytes read in. Returns ``None`` on timeout. @@ -95,14 +99,16 @@ Methods .. method:: UART.readinto(buf[, nbytes]) Read bytes into the ``buf``. If ``nbytes`` is specified then read at most - that many bytes. Otherwise, read at most ``len(buf)`` bytes. + that many bytes. Otherwise, read at most ``len(buf)`` bytes. It may return sooner if a timeout + is reached. The timeout is configurable in the constructor. Return value: number of bytes read and stored into ``buf`` or ``None`` on timeout. .. method:: UART.readline() - Read a line, ending in a newline character. + Read a line, ending in a newline character. It may return sooner if a timeout + is reached. The timeout is configurable in the constructor. Return value: the line read or ``None`` on timeout. |