Skip to content

Commit 678860a

Browse files
committed
Update documentation for new pin_usb_tx/rx pins and uart.init behaviour.
1 parent 4a11a23 commit 678860a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

docs/uart.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@ a serial interface.
1010
Functions
1111
=========
1212

13-
.. method:: init(baudrate=9600, bits=8, parity=None, stop=1, pins=None)
13+
.. method:: init(baudrate=9600, bits=8, parity=None, stop=1, \*, tx=None, rx=None)
1414

1515
Initialize serial communication with the specified parameters on the
16-
specified ``pins``. Note that for correct communication, the parameters
16+
specified ``tx`` and ``rx`` pins. Note that for correct communication, the parameters
1717
have to be the same on both communicating devices.
1818

1919
.. warning::
2020

21-
Initializing the UART will cause the Python console on USB to become
22-
unaccessible, as it uses the same hardware. There is currently no way
23-
to bring the console back, without restarting the module.
21+
Initializing the UART on external pins will cause the Python console on
22+
USB to become unaccessible, as it uses the same hardware. To bring the
23+
console back you must reinitialize the UART without passing anything for
24+
``tx'' or ``rx'' (or passing ``None'' to these arguments). This means
25+
that calling ``uart.init(115200)'' is enough to restore the Python console.
2426
2527
The ``baudrate`` defines the speed of communication. Common baud
2628
rates include:
@@ -39,10 +41,10 @@ Functions
3941
The ``stop`` parameter tells the number of stop bits, and has to be 1 for
4042
this board.
4143

42-
If no ``pins`` are specified, ``microbit.pin0`` is used as the TX pin, and
43-
``microbit.pin1`` as the RX pin. You can also specify which pins you want
44-
by passing a tuple of two pins as ``pins``, the first one being TX, and the
45-
second one, RX.
44+
If ``tx`` and ``rx`` are not specified then the internal USB-UART TX/RX pins
45+
are used which connect to the USB serial convertor on the micro:bit, thus
46+
connecting the UART to your PC. You can specify any other pins you want by
47+
passing the desired pin objects to the ``tx`` and ``rx`` parameters.
4648

4749
.. note::
4850

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy