Skip to content

Commit e30ba2f

Browse files
committed
docs/library: Add description of "index" parameter to uos.dupterm().
1 parent 6568001 commit e30ba2f

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

docs/library/uos.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,22 @@ Functions
8989
Return a bytes object with n random bytes. Whenever possible, it is
9090
generated by the hardware random number generator.
9191

92-
.. function:: dupterm(stream_object)
92+
.. function:: dupterm(stream_object, index=0)
9393

94-
Duplicate or switch MicroPython terminal (the REPL) on the passed stream-like
95-
object. The given object must implement the ``readinto()`` and ``write()``
96-
methods. If ``None`` is passed, previously set redirection is cancelled.
94+
Duplicate or switch the MicroPython terminal (the REPL) on the given stream-like
95+
object. The *stream_object* argument must implement the ``readinto()`` and
96+
``write()`` methods. The stream should be in non-blocking mode and
97+
``readinto()`` should return ``None`` if there is no data available for reading.
98+
99+
After calling this function all terminal output is repeated on this stream,
100+
and any input that is available on the stream is passed on to the terminal input.
101+
102+
The *index* parameter should be a non-negative integer and specifies which
103+
duplication slot is set. A given port may implement more than one slot (slot 0
104+
will always be available) and in that case terminal input and output is
105+
duplicated on all the slots that are set.
106+
107+
If ``None`` is passed as the *stream_object* then duplication is cancelled on
108+
the slot given by *index*.
109+
110+
The function returns the previous stream-like object in the given slot.

0 commit comments

Comments
 (0)