From b7ab70c71c3db3fd81aeadb50874615977b1eadb Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 25 Oct 2015 13:24:29 +0300 Subject: [PATCH] docs: USB_VCP: Always in non-blocking mode, clarify stream method returns. They return None if no data available. --- docs/library/pyb.USB_VCP.rst | 11 +++++++---- 1 file 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()