Skip to content

Commit

Permalink
docs/library/machine.UART: Notes on UART init() and deinit().
Browse files Browse the repository at this point in the history
* `init()` can be called multiple times to reconfigure UART.
* After `deinit()` it is impossible to call `init()` again.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
  • Loading branch information
cederom committed Aug 18, 2022
1 parent c26d250 commit fefa2ae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/library/machine.UART.rst
Expand Up @@ -87,10 +87,22 @@ Methods
When no pins are given, then the default set of TX and RX pins is taken, and hardware
flow control will be disabled. If *pins* is ``None``, no pin assignment will be made.

.. note::
It is possible to call ``init()`` multiple times on the same object in
order to reconfigure UART on the fly. That allows using single UART
peripheral to serve different devices attached to different GPIO pins.
Only one device can be served at a time in that case.
Also do not call ``deinit()`` as it will prevent calling ``init()``
again. Tested on ESP32.

.. method:: UART.deinit()

Turn off the UART bus.

.. note::
You will not be able to call ``init()`` on the object after ``deinit()``.
A new instance needs to be created in that case.

.. method:: UART.any()

Returns an integer counting the number of characters that can be read without
Expand Down

0 comments on commit fefa2ae

Please sign in to comment.