Skip to content

Commit 00effe0

Browse files
dpgeorgerobert-hh
authored andcommitted
docs/library/machine.UART: Fix UART.irq docs to match current code.
These docs now match the code in `extmod/machine_uart.c`. Signed-off-by: Damien George <damien@micropython.org>
1 parent 7b78046 commit 00effe0

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

docs/library/machine.UART.rst

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -152,31 +152,6 @@ Methods
152152
Send a break condition on the bus. This drives the bus low for a duration
153153
longer than required for a normal transmission of a character.
154154

155-
.. method:: UART.irq(trigger, priority=1, handler=None, wake=machine.IDLE)
156-
157-
Create a callback to be triggered when data is received on the UART.
158-
159-
- *trigger* can only be ``UART.RX_ANY``
160-
- *priority* level of the interrupt. Can take values in the range 1-7.
161-
Higher values represent higher priorities.
162-
- *handler* an optional function to be called when new characters arrive.
163-
- *wake* can only be ``machine.IDLE``.
164-
165-
.. note::
166-
167-
The handler will be called whenever any of the following two conditions are met:
168-
169-
- 8 new characters have been received.
170-
- At least 1 new character is waiting in the Rx buffer and the Rx line has been
171-
silent for the duration of 1 complete frame.
172-
173-
This means that when the handler function is called there will be between 1 to 8
174-
characters waiting.
175-
176-
Returns an irq object.
177-
178-
Availability: WiPy.
179-
180155
.. method:: UART.flush()
181156

182157
Waits until all data has been sent. In case of a timeout, an exception is raised. The timeout
@@ -203,11 +178,42 @@ Methods
203178

204179
Availability: rp2, esp32, esp8266, mimxrt, cc3200, stm32, nrf ports, renesas-ra
205180

181+
.. method:: UART.irq(handler=None, trigger=0, hard=False)
182+
183+
Configure an interrupt handler to be called when a UART event occurs.
184+
185+
The arguments are:
186+
187+
- *handler* is an optional function to be called when the interrupt event
188+
triggers. The handler must take exactly one argument which is the
189+
``UART`` instance.
190+
191+
- *trigger* configures the event which can generate an interrupt.
192+
Possible values are:
193+
194+
- ``UART.IRQ_RXIDLE`` interrupt after receiving at least one character
195+
and then the RX line goes idle.
196+
197+
- *hard* if true a hardware interrupt is used. This reduces the delay
198+
between the pin change and the handler being called. Hard interrupt
199+
handlers may not allocate memory; see :ref:`isr_rules`.
200+
201+
Returns an irq object.
202+
203+
Availability: renesas-ra, stm32.
204+
206205
Constants
207206
---------
208207

209-
.. data:: UART.RX_ANY
208+
.. data:: UART.RTS
209+
UART.CTS
210+
211+
Flow control options.
212+
213+
Availability: esp32, mimxrt, renesas-ra, rp2, stm32.
214+
215+
.. data:: UART.IRQ_RXIDLE
210216

211-
IRQ trigger sources
217+
IRQ trigger sources.
212218

213-
Availability: WiPy.
219+
Availability: stm32.

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