docs/library/machine.UART: Remove conditional docs for wipy port.

The UART.init() method is now included unconditionally and its wording
adjusted to better describe ports other than the cc3200.

UART.irq() is also included unconditionally, but this is currently only
available on the WiPy target.
pull/3948/merge
Damien George 2018-07-18 16:20:53 +10:00
rodzic 164377f806
commit 4cc65e22d4
1 zmienionych plików z 42 dodań i 34 usunięć

Wyświetl plik

@ -43,21 +43,27 @@ Constructors
Methods Methods
------- -------
.. only:: port_wipy .. method:: UART.init(baudrate=9600, bits=8, parity=None, stop=1, \*, ...)
.. method:: UART.init(baudrate=9600, bits=8, parity=None, stop=1, \*, pins=(TX, RX, RTS, CTS)) Initialise the UART bus with the given parameters:
Initialise the UART bus with the given parameters: - *baudrate* is the clock rate.
- *bits* is the number of bits per character, 7, 8 or 9.
- ``baudrate`` is the clock rate. - *parity* is the parity, ``None``, 0 (even) or 1 (odd).
- ``bits`` is the number of bits per character, 7, 8 or 9. - *stop* is the number of stop bits, 1 or 2.
- ``parity`` is the parity, ``None``, 0 (even) or 1 (odd).
- ``stop`` is the number of stop bits, 1 or 2. Additional keyword-only parameters that may be supported by a port are:
- ``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. - *tx* specifies the TX pin to use.
If the RTS pin is given the the RX pin must be given as well. The same applies to CTS. - *rx* specifies the RX pin to use.
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=None, no pin assignment will be made. On the WiPy only the following keyword-only parameter is supported:
- *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.
If the RTS pin is given the the RX pin must be given as well. The same applies to CTS.
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.
.. method:: UART.deinit() .. method:: UART.deinit()
@ -109,34 +115,36 @@ Methods
Send a break condition on the bus. This drives the bus low for a duration Send a break condition on the bus. This drives the bus low for a duration
longer than required for a normal transmission of a character. longer than required for a normal transmission of a character.
.. only:: port_wipy .. method:: UART.irq(trigger, priority=1, handler=None, wake=machine.IDLE)
.. method:: UART.irq(trigger, priority=1, handler=None, wake=machine.IDLE) Create a callback to be triggered when data is received on the UART.
Create a callback to be triggered when data is received on the UART. - *trigger* can only be ``UART.RX_ANY``
- *priority* level of the interrupt. Can take values in the range 1-7.
Higher values represent higher priorities.
- *handler* an optional function to be called when new characters arrive.
- *wake* can only be ``machine.IDLE``.
- ``trigger`` can only be ``UART.RX_ANY`` .. note::
- ``priority`` level of the interrupt. Can take values in the range 1-7.
Higher values represent higher priorities.
- ``handler`` an optional function to be called when new characters arrive.
- ``wake`` can only be ``machine.IDLE``.
.. note:: The handler will be called whenever any of the following two conditions are met:
The handler will be called whenever any of the following two conditions are met: - 8 new characters have been received.
- At least 1 new character is waiting in the Rx buffer and the Rx line has been
silent for the duration of 1 complete frame.
- 8 new characters have been received. This means that when the handler function is called there will be between 1 to 8
- At least 1 new character is waiting in the Rx buffer and the Rx line has been characters waiting.
silent for the duration of 1 complete frame.
This means that when the handler function is called there will be between 1 to 8 Returns an irq object.
characters waiting.
Returns an irq object. Availability: WiPy.
Constants Constants
--------- ---------
.. data:: UART.RX_ANY .. data:: UART.RX_ANY
IRQ trigger sources IRQ trigger sources
Availability: WiPy.