Browse Source

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

pull/2632/head
Damien George 8 years ago
parent
commit
a392b3aa75
  1. 11
      docs/library/machine.UART.rst
  2. 11
      docs/library/pyb.UART.rst
  3. 10
      docs/library/pyb.USB_VCP.rst
  4. 8
      docs/library/usocket.rst

11
docs/library/machine.UART.rst

@ -31,7 +31,7 @@ A UART object acts like a stream object and reading and writing is done
using the standard stream methods:: using the standard stream methods::
uart.read(10) # read 10 characters, returns a bytes object 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.readline() # read a line
uart.readinto(buf) # read and store into the given buffer uart.readinto(buf) # read and store into the given buffer
uart.write('abc') # write the 3 characters uart.write('abc') # write the 3 characters
@ -95,17 +95,12 @@ Methods
.. method:: UART.read([nbytes]) .. 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`` Return value: a bytes object containing the bytes read in. Returns ``None``
on timeout. 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]) .. method:: UART.readinto(buf[, nbytes])
Read bytes into the ``buf``. If ``nbytes`` is specified then read at most Read bytes into the ``buf``. If ``nbytes`` is specified then read at most

11
docs/library/pyb.UART.rst

@ -27,7 +27,7 @@ A UART object acts like a stream object and reading and writing is done
using the standard stream methods:: using the standard stream methods::
uart.read(10) # read 10 characters, returns a bytes object 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.readline() # read a line
uart.readinto(buf) # read and store into the given buffer uart.readinto(buf) # read and store into the given buffer
uart.write('abc') # write the 3 characters uart.write('abc') # write the 3 characters
@ -122,6 +122,9 @@ Methods
If ``nbytes`` are available in the buffer, returns immediately, otherwise returns If ``nbytes`` are available in the buffer, returns immediately, otherwise returns
when sufficient characters arrive or the timeout elapses. 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 .. only:: port_pyboard
*Note:* for 9 bit characters each character takes two bytes, ``nbytes`` must *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`` Return value: a bytes object containing the bytes read in. Returns ``None``
on timeout. 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() .. method:: UART.readchar()
Receive a single character on the bus. Receive a single character on the bus.

10
docs/library/pyb.USB_VCP.rst

@ -44,16 +44,12 @@ Methods
.. method:: USB_VCP.read([nbytes]) .. method:: USB_VCP.read([nbytes])
Read at most ``nbytes`` from the serial device and return them as a 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 bytes object. If ``nbytes`` is not specified then the method reads
``readall()``. USB_VCP stream implicitly works in non-blocking mode, 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 so if no pending data available, this method will return immediately
with ``None`` value. 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]) .. method:: USB_VCP.readinto(buf, [maxlen])
Read bytes from the serial device and store them into ``buf``, which Read bytes from the serial device and store them into ``buf``, which

8
docs/library/usocket.rst

@ -178,14 +178,10 @@ Methods
Closing the file object returned by makefile() WILL close the Closing the file object returned by makefile() WILL close the
original socket as well. 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 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. reads all data available from the socket until ``EOF``; as such the method will not return until
.. method:: socket.readall()
Read all data available from the socket until ``EOF``. This function will not return until
the socket is closed. the socket is closed.
.. method:: socket.readinto(buf[, nbytes]) .. method:: socket.readinto(buf[, nbytes])

Loading…
Cancel
Save