Skip to content

Commit 5d39e46

Browse files
authored
Merge pull request #10019 from dhalbert/usb_cdc.Serial.read-doc
Fix usb_cdc.Serial.read() documentation
2 parents 538818c + 6d8cca4 commit 5d39e46

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

shared-bindings/usb_cdc/Serial.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@
2222
//| The available instances are in the ``usb_cdc.serials`` tuple."""
2323
//| ...
2424
//|
25-
//| def read(self, size: int = 1) -> bytes:
26-
//| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size
27-
//| only the bytes in the buffer will be read. If `timeout` is > 0 or ``None``,
28-
//| and fewer than ``size`` bytes are available, keep waiting until the timeout
29-
//| expires or ``size`` bytes are available.
25+
//| def read(self, size: int = -1) -> bytes:
26+
//| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size,
27+
//| only the bytes in the buffer will be read. If ``size`` is not specified or is ``-1``,
28+
//| read as many bytes as possible, until the timeout expires.
29+
//| If `timeout` is > 0 or ``None``, and fewer than ``size`` bytes are available,
30+
//| keep waiting until the timeout expires or ``size`` bytes are available.
31+
//|
32+
//| If no bytes are read, return ``b''``. This is unlike, say, `busio.UART.read()`, which
33+
//| would return ``None``.
3034
//|
3135
//| :return: Data read
3236
//| :rtype: bytes"""

0 commit comments

Comments
 (0)