Commit a392b3aa authored by Damien George's avatar Damien George
Browse files

docs: Remove references to readall() and update stream read() docs.

parent aed3b5b7
......@@ -31,7 +31,7 @@ A UART object acts like a stream object and reading and writing is done
using the standard stream methods::
uart.read(10) # read 10 characters, returns a bytes object
uart.readall() # read all available characters
uart.read() # read all available characters
uart.readline() # read a line
uart.readinto(buf) # read and store into the given buffer
uart.write('abc') # write the 3 characters
......@@ -95,17 +95,12 @@ Methods
.. method:: UART.read([nbytes])
Read characters. If ``nbytes`` is specified then read at most that many bytes.
Read characters. If ``nbytes`` is specified then read at most that many bytes,
otherwise read as much data as possible.
Return value: a bytes object containing the bytes read in. Returns ``None``
on timeout.
.. method:: UART.readall()
Read as much data as possible.
Return value: a bytes object or ``None`` on timeout.
.. method:: UART.readinto(buf[, nbytes])
Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
......
......@@ -27,7 +27,7 @@ A UART object acts like a stream object and reading and writing is done
using the standard stream methods::
uart.read(10) # read 10 characters, returns a bytes object
uart.readall() # read all available characters
uart.read() # read all available characters
uart.readline() # read a line
uart.readinto(buf) # read and store into the given buffer
uart.write('abc') # write the 3 characters
......@@ -122,6 +122,9 @@ Methods
If ``nbytes`` are available in the buffer, returns immediately, otherwise returns
when sufficient characters arrive or the timeout elapses.
If ``nbytes`` is not given then the method reads as much data as possible. It
returns after the timeout has elapsed.
.. only:: port_pyboard
*Note:* for 9 bit characters each character takes two bytes, ``nbytes`` must
......@@ -130,12 +133,6 @@ Methods
Return value: a bytes object containing the bytes read in. Returns ``None``
on timeout.
.. method:: UART.readall()
Read as much data as possible. Returns after the timeout has elapsed.
Return value: a bytes object or ``None`` if timeout prevents any data being read.
.. method:: UART.readchar()
Receive a single character on the bus.
......
......@@ -44,16 +44,12 @@ Methods
.. method:: USB_VCP.read([nbytes])
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()``. USB_VCP stream implicitly works in non-blocking mode,
bytes object. If ``nbytes`` is not specified then the method reads
all available bytes from the serial device.
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, or ``None`` if no pending data available.
.. method:: USB_VCP.readinto(buf, [maxlen])
Read bytes from the serial device and store them into ``buf``, which
......
......@@ -178,14 +178,10 @@ Methods
Closing the file object returned by makefile() WILL close the
original socket as well.
.. method:: socket.read(size)
.. method:: socket.read([size])
Read up to size bytes from the socket. Return a bytes object. If ``size`` is not given, it
behaves just like ``socket.readall()``, see below.
.. method:: socket.readall()
Read all data available from the socket until ``EOF``. This function will not return until
reads all data available from the socket until ``EOF``; as such the method will not return until
the socket is closed.
.. method:: socket.readinto(buf[, nbytes])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment