diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-25 13:24:29 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-25 13:24:29 +0300 |
commit | b7ab70c71c3db3fd81aeadb50874615977b1eadb (patch) | |
tree | e7f72c5835ab6c9291cd1771f81e190e5d38343b | |
parent | cf6daa096681dd2926e37415eb10ac99c36f5c0d (diff) | |
download | micropython-b7ab70c71c3db3fd81aeadb50874615977b1eadb.tar.gz micropython-b7ab70c71c3db3fd81aeadb50874615977b1eadb.zip |
docs: USB_VCP: Always in non-blocking mode, clarify stream method returns.
They return None if no data available.
-rw-r--r-- | docs/library/pyb.USB_VCP.rst | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/library/pyb.USB_VCP.rst b/docs/library/pyb.USB_VCP.rst index 07122bed3c..cc4dbe5903 100644 --- a/docs/library/pyb.USB_VCP.rst +++ b/docs/library/pyb.USB_VCP.rst @@ -43,12 +43,14 @@ Methods Read at most ``nbytes`` from the serial device and return them as a bytes object. If ``nbytes`` is not specified then the method acts as - ``readall()``. + ``readall()``. USB_VCP stream implicitly works in non-blocking mode, + so if no pending data available, this method will return immediately + with ``None`` value. .. method:: usb_vcp.readall() Read all available bytes from the serial device and return them as - a bytes object. + a bytes object, or ``None`` if no pending data available. .. method:: usb_vcp.readinto(buf, [maxlen]) @@ -57,14 +59,15 @@ Methods If ``maxlen`` is given and then at most ``min(maxlen, len(buf))`` bytes are read. - Returns the number of bytes read and stored into ``buf``. + Returns the number of bytes read and stored into ``buf`` or ``None`` + if no pending data available. .. method:: usb_vcp.readline() Read a whole line from the serial device. Returns a bytes object containing the data, including the trailing - newline character. + newline character or ``None`` if no pending data available. .. method:: usb_vcp.readlines() |