Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
a392b3aa
Commit
a392b3aa
authored
Nov 14, 2016
by
Damien George
Browse files
docs: Remove references to readall() and update stream read() docs.
parent
aed3b5b7
Changes
4
Hide whitespace changes
Inline
Side-by-side
docs/library/machine.UART.rst
View file @
a392b3aa
...
@@ -31,7 +31,7 @@ A UART object acts like a stream object and reading and writing is done
...
@@ -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.read
all()
# 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
...
@@ -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
...
...
docs/library/pyb.UART.rst
View file @
a392b3aa
...
@@ -27,7 +27,7 @@ A UART object acts like a stream object and reading and writing is done
...
@@ -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.read
all()
# 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
...
@@ -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
...
@@ -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.
...
...
docs/library/pyb.USB_VCP.rst
View file @
a392b3aa
...
@@ -44,16 +44,12 @@ Methods
...
@@ -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
...
...
docs/library/usocket.rst
View file @
a392b3aa
...
@@ -178,14 +178,10 @@ Methods
...
@@ -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])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment