diff options
author | Damien George <damien.p.george@gmail.com> | 2017-06-14 16:02:57 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-08-29 16:50:28 +1000 |
commit | e30ba2f1c7d0cccaf62640aa97de9fd6e82dcab7 (patch) | |
tree | cdd88dc147e002d8982a15d83fab781cea7d271a /docs/library | |
parent | 6568001c00112e14164a03ead6092491520a9b47 (diff) |
docs/library: Add description of "index" parameter to uos.dupterm().
Diffstat (limited to 'docs/library')
-rw-r--r-- | docs/library/uos.rst | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/docs/library/uos.rst b/docs/library/uos.rst index 7c52c1eea..43bf69cc0 100644 --- a/docs/library/uos.rst +++ b/docs/library/uos.rst @@ -89,8 +89,22 @@ Functions Return a bytes object with n random bytes. Whenever possible, it is generated by the hardware random number generator. -.. function:: dupterm(stream_object) +.. function:: dupterm(stream_object, index=0) - Duplicate or switch MicroPython terminal (the REPL) on the passed stream-like - object. The given object must implement the ``readinto()`` and ``write()`` - methods. If ``None`` is passed, previously set redirection is cancelled. + Duplicate or switch the MicroPython terminal (the REPL) on the given stream-like + object. The *stream_object* argument must implement the ``readinto()`` and + ``write()`` methods. The stream should be in non-blocking mode and + ``readinto()`` should return ``None`` if there is no data available for reading. + + After calling this function all terminal output is repeated on this stream, + and any input that is available on the stream is passed on to the terminal input. + + The *index* parameter should be a non-negative integer and specifies which + duplication slot is set. A given port may implement more than one slot (slot 0 + will always be available) and in that case terminal input and output is + duplicated on all the slots that are set. + + If ``None`` is passed as the *stream_object* then duplication is cancelled on + the slot given by *index*. + + The function returns the previous stream-like object in the given slot. |