From 6d8cca41f24807e974ccf2f22bb799676a0e6946 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 30 Jan 2025 16:53:56 -0500 Subject: [PATCH] Fix usb_cdc.Serial.read() documentation --- shared-bindings/usb_cdc/Serial.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/shared-bindings/usb_cdc/Serial.c b/shared-bindings/usb_cdc/Serial.c index 9fc5de21bcda1..1fd5ed4afcfdf 100644 --- a/shared-bindings/usb_cdc/Serial.c +++ b/shared-bindings/usb_cdc/Serial.c @@ -22,11 +22,15 @@ //| The available instances are in the ``usb_cdc.serials`` tuple.""" //| ... //| -//| def read(self, size: int = 1) -> bytes: -//| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size -//| only the bytes in the buffer will be read. If `timeout` is > 0 or ``None``, -//| and fewer than ``size`` bytes are available, keep waiting until the timeout -//| expires or ``size`` bytes are available. +//| def read(self, size: int = -1) -> bytes: +//| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size, +//| only the bytes in the buffer will be read. If ``size`` is not specified or is ``-1``, +//| read as many bytes as possible, until the timeout expires. +//| If `timeout` is > 0 or ``None``, and fewer than ``size`` bytes are available, +//| keep waiting until the timeout expires or ``size`` bytes are available. +//| +//| If no bytes are read, return ``b''``. This is unlike, say, `busio.UART.read()`, which +//| would return ``None``. //| //| :return: Data read //| :rtype: bytes""" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy