docs/library/machine.UART: Add notes about UART init and deinit.

* `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>
pull/6044/merge
Tomasz 'CeDeROM' CEDRO 2022-08-18 06:02:53 +02:00 zatwierdzone przez Damien George
rodzic 769262ef03
commit 602f9db2f3
1 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -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.
.. 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