Skip to content

Commit b7ab70c

Browse files
committed
docs: USB_VCP: Always in non-blocking mode, clarify stream method returns.
They return None if no data available.
1 parent cf6daa0 commit b7ab70c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/library/pyb.USB_VCP.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ Methods
4343

4444
Read at most ``nbytes`` from the serial device and return them as a
4545
bytes object. If ``nbytes`` is not specified then the method acts as
46-
``readall()``.
46+
``readall()``. USB_VCP stream implicitly works in non-blocking mode,
47+
so if no pending data available, this method will return immediately
48+
with ``None`` value.
4749

4850
.. method:: usb_vcp.readall()
4951

5052
Read all available bytes from the serial device and return them as
51-
a bytes object.
53+
a bytes object, or ``None`` if no pending data available.
5254

5355
.. method:: usb_vcp.readinto(buf, [maxlen])
5456

@@ -57,14 +59,15 @@ Methods
5759
If ``maxlen`` is given and then at most ``min(maxlen, len(buf))`` bytes
5860
are read.
5961

60-
Returns the number of bytes read and stored into ``buf``.
62+
Returns the number of bytes read and stored into ``buf`` or ``None``
63+
if no pending data available.
6164

6265
.. method:: usb_vcp.readline()
6366

6467
Read a whole line from the serial device.
6568

6669
Returns a bytes object containing the data, including the trailing
67-
newline character.
70+
newline character or ``None`` if no pending data available.
6871

6972
.. method:: usb_vcp.readlines()
7073

0 commit comments

Comments
 (0)