Browse Source

docs/library/machine.UART: Remove some conditionals.

pull/2922/head
Paul Sokolovsky 8 years ago
parent
commit
1d74559b6b
  1. 35
      docs/library/machine.UART.rst

35
docs/library/machine.UART.rst

@ -15,17 +15,13 @@ UART objects can be created and initialised using::
uart = UART(1, 9600) # init with given baudrate
uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters
.. only:: port_machineoard
Supported paramters differ on a board:
Bits can be 7, 8 or 9. Parity can be None, 0 (even) or 1 (odd). Stop can be 1 or 2.
*Note:* with parity=None, only 8 and 9 bits are supported. With parity enabled,
only 7 and 8 bits are supported.
.. only:: port_wipy
Bits can be 5, 6, 7, 8. Parity can be ``None``, ``UART.EVEN`` or ``UART.ODD``. Stop can be 1 or 2.
Pyboard: Bits can be 7, 8 or 9. Stop can be 1 or 2. With `parity=None`,
only 8 and 9 bits are supported. With parity enabled, only 7 and 8 bits
are supported.
WiPy/CC3200: Bits can be 5, 6, 7, 8. Stop can be 1 or 2.
A UART object acts like a stream object and reading and writing is done
using the standard stream methods::
@ -47,22 +43,12 @@ using the standard stream methods::
uart.any() # returns True if any characters waiting
.. only:: port_wipy
To check if there is anything to be read, use::
uart.any() # returns the number of characters available for reading
Constructors
------------
.. only:: port_wipy
.. class:: UART(id, ...)
.. class:: UART(bus, ...)
Construct a UART object on the given bus. ``bus`` can be 0 or 1.
If the bus is not given, the default one will be selected (0) or the selection
will be made based on the given pins.
Construct a UART object of the given id.
Methods
-------
@ -75,7 +61,7 @@ Methods
- ``baudrate`` is the clock rate.
- ``bits`` is the number of bits per character, 7, 8 or 9.
- ``parity`` is the parity, ``None``, ``UART.EVEN`` or ``UART.ODD``.
- ``parity`` is the parity, ``None``, 0 (even) or 1 (odd).
- ``stop`` is the number of stop bits, 1 or 2.
- ``pins`` is a 4 or 2 item list indicating the TX, RX, RTS and CTS pins (in that order).
Any of the pins can be None if one wants the UART to operate with limited functionality.
@ -159,11 +145,6 @@ Methods
Constants
---------
.. data:: UART.EVEN
.. data:: UART.ODD
parity types (along with ``None``)
.. data:: UART.RX_ANY
IRQ trigger sources

Loading…
Cancel
Save