summaryrefslogtreecommitdiffstatshomepage
path: root/docs/library/machine.UART.rst
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-03-06 13:51:31 +1100
committerDamien George <damien@micropython.org>2024-08-29 16:34:45 +1000
commit9bbe61607ac3e97d96294d588afd09d82613c6a9 (patch)
tree67bca03b9e3890309d6f363cf94e0b8015b2c4e9 /docs/library/machine.UART.rst
parenta38b4f42876cf274d77752f5f8cc559deb87f9fa (diff)
downloadmicropython-9bbe61607ac3e97d96294d588afd09d82613c6a9.tar.gz
micropython-9bbe61607ac3e97d96294d588afd09d82613c6a9.zip
docs/library/machine.UART: Fix UART.irq docs to match current code.
These docs now match the code in `extmod/machine_uart.c`. IRQ trigger support still need to be updated for each port (to be done in a follow-up commit). Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'docs/library/machine.UART.rst')
-rw-r--r--docs/library/machine.UART.rst62
1 files changed, 34 insertions, 28 deletions
diff --git a/docs/library/machine.UART.rst b/docs/library/machine.UART.rst
index 072bdb7188..6f47eb9abb 100644
--- a/docs/library/machine.UART.rst
+++ b/docs/library/machine.UART.rst
@@ -152,31 +152,6 @@ Methods
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.
-.. method:: UART.irq(trigger, priority=1, handler=None, wake=machine.IDLE)
-
- 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``.
-
- .. note::
-
- 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.
-
- This means that when the handler function is called there will be between 1 to 8
- characters waiting.
-
- Returns an irq object.
-
- Availability: WiPy.
-
.. method:: UART.flush()
Waits until all data has been sent. In case of a timeout, an exception is raised. The timeout
@@ -203,11 +178,42 @@ Methods
Availability: rp2, esp32, esp8266, mimxrt, cc3200, stm32, nrf ports, renesas-ra
+.. method:: UART.irq(handler=None, trigger=0, hard=False)
+
+ Configure an interrupt handler to be called when a UART event occurs.
+
+ The arguments are:
+
+ - *handler* is an optional function to be called when the interrupt event
+ triggers. The handler must take exactly one argument which is the
+ ``UART`` instance.
+
+ - *trigger* configures the event which can generate an interrupt.
+ Possible values are:
+
+ - ``UART.IRQ_RXIDLE`` interrupt after receiving at least one character
+ and then the RX line goes idle.
+
+ - *hard* if true a hardware interrupt is used. This reduces the delay
+ between the pin change and the handler being called. Hard interrupt
+ handlers may not allocate memory; see :ref:`isr_rules`.
+
+ Returns an irq object.
+
+ Availability: renesas-ra, stm32.
+
Constants
---------
-.. data:: UART.RX_ANY
+.. data:: UART.RTS
+ UART.CTS
+
+ Flow control options.
+
+ Availability: esp32, mimxrt, renesas-ra, rp2, stm32.
+
+.. data:: UART.IRQ_RXIDLE
- IRQ trigger sources
+ IRQ trigger sources.
- Availability: WiPy.
+ Availability: stm32.