@@ -152,31 +152,6 @@ Methods
152
152
Send a break condition on the bus. This drives the bus low for a duration
153
153
longer than required for a normal transmission of a character.
154
154
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
-
180
155
.. method :: UART.flush()
181
156
182
157
Waits until all data has been sent. In case of a timeout, an exception is raised. The timeout
@@ -203,11 +178,42 @@ Methods
203
178
204
179
Availability: rp2, esp32, esp8266, mimxrt, cc3200, stm32, nrf ports, renesas-ra
205
180
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
+
206
205
Constants
207
206
---------
208
207
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
210
216
211
- IRQ trigger sources
217
+ IRQ trigger sources.
212
218
213
- Availability: WiPy .
219
+ Availability: stm32 .
0 commit comments