forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
UART.c
463 lines (403 loc) · 18.5 KB
/
UART.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
//
// SPDX-License-Identifier: MIT
#include <stdint.h>
#include "shared-bindings/busio/UART.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/util.h"
#include "shared/runtime/context_manager_helpers.h"
#include "shared/runtime/interrupt_char.h"
#include "py/stream.h"
#include "py/objproperty.h"
#include "py/objtype.h"
#include "py/runtime.h"
#include "py/stream.h"
#define STREAM_DEBUG(...) (void)0
// #define STREAM_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
//| class UART:
//| """A bidirectional serial protocol
//|
//| .. raw:: html
//|
//| <p>
//| <details>
//| <summary>Available on these boards</summary>
//| <ul>
//| {% for board in support_matrix_reverse["busio.UART"] %}
//| <li> {{ board }}
//| {% endfor %}
//| </ul>
//| </details>
//| </p>
//|
//| """
//|
//| def __init__(
//| self,
//| tx: Optional[microcontroller.Pin] = None,
//| rx: Optional[microcontroller.Pin] = None,
//| *,
//| rts: Optional[microcontroller.Pin] = None,
//| cts: Optional[microcontroller.Pin] = None,
//| rs485_dir: Optional[microcontroller.Pin] = None,
//| rs485_invert: bool = False,
//| baudrate: int = 9600,
//| bits: int = 8,
//| parity: Optional[Parity] = None,
//| stop: int = 1,
//| timeout: float = 1,
//| receiver_buffer_size: int = 64
//| ) -> None:
//| """A common bidirectional serial protocol that uses an an agreed upon speed
//| rather than a shared clock line.
//|
//| :param ~microcontroller.Pin tx: the pin to transmit with, or ``None`` if this ``UART`` is receive-only.
//| :param ~microcontroller.Pin rx: the pin to receive on, or ``None`` if this ``UART`` is transmit-only.
//| :param ~microcontroller.Pin rts: the pin for rts, or ``None`` if rts not in use.
//| :param ~microcontroller.Pin cts: the pin for cts, or ``None`` if cts not in use.
//| :param ~microcontroller.Pin rs485_dir: the output pin for rs485 direction setting, or ``None`` if rs485 not in use.
//| :param bool rs485_invert: rs485_dir pin active high when set. Active low otherwise.
//| :param int baudrate: the transmit and receive speed.
//| :param int bits: the number of bits per byte, 5 to 9.
//| :param Parity parity: the parity used for error checking.
//| :param int stop: the number of stop bits, 1 or 2.
//| :param float timeout: the timeout in seconds to wait for the first character and between subsequent characters when reading. Raises ``ValueError`` if timeout >100 seconds.
//| :param int receiver_buffer_size: the character length of the read buffer (0 to disable). (When a character is 9 bits the buffer will be 2 * receiver_buffer_size bytes.)
//|
//| ``tx`` and ``rx`` cannot both be ``None``.
//|
//| *New in CircuitPython 4.0:* ``timeout`` has incompatibly changed units from milliseconds to seconds.
//| The new upper limit on ``timeout`` is meant to catch mistaken use of milliseconds.
//|
//| **Limitations:** RS485 is not supported on SAMD, Nordic, Broadcom, Spresense, or STM.
//| On i.MX and Raspberry Pi RP2040, RS485 support is implemented in software:
//| The timing for the ``rs485_dir`` pin signal is done on a best-effort basis, and may not meet
//| RS485 specifications intermittently.
//| """
//| ...
typedef struct {
mp_obj_base_t base;
} busio_uart_parity_obj_t;
extern const busio_uart_parity_obj_t busio_uart_parity_even_obj;
extern const busio_uart_parity_obj_t busio_uart_parity_odd_obj;
#if CIRCUITPY_BUSIO_UART
static void validate_timeout(mp_float_t timeout) {
mp_arg_validate_int_range((int)timeout, 0, 100, MP_QSTR_timeout);
}
#endif // CIRCUITPY_BUSIO_UART
static mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
#if CIRCUITPY_BUSIO_UART
enum { ARG_tx, ARG_rx, ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_timeout, ARG_receiver_buffer_size,
ARG_rts, ARG_cts, ARG_rs485_dir, ARG_rs485_invert};
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_tx, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_rx, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 9600} },
{ MP_QSTR_bits, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 8} },
{ MP_QSTR_parity, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_stop, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(1)} },
{ MP_QSTR_receiver_buffer_size, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 64} },
{ MP_QSTR_rts, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_cts, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_rs485_dir, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none } },
{ MP_QSTR_rs485_invert, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false } },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const mcu_pin_obj_t *rx = validate_obj_is_free_pin_or_none(args[ARG_rx].u_obj, MP_QSTR_rx);
const mcu_pin_obj_t *tx = validate_obj_is_free_pin_or_none(args[ARG_tx].u_obj, MP_QSTR_tx);
const mcu_pin_obj_t *rts = validate_obj_is_free_pin_or_none(args[ARG_rts].u_obj, MP_QSTR_rts);
const mcu_pin_obj_t *cts = validate_obj_is_free_pin_or_none(args[ARG_cts].u_obj, MP_QSTR_cts);
const mcu_pin_obj_t *rs485_dir = validate_obj_is_free_pin_or_none(args[ARG_rs485_dir].u_obj, MP_QSTR_rs485_dir);
if ((tx == NULL) && (rx == NULL)) {
mp_raise_ValueError(MP_ERROR_TEXT("tx and rx cannot both be None"));
}
// Pins must be distinct.
if ((tx != NULL && (tx == rx || tx == rts || tx == cts || tx == rs485_dir)) ||
(rx != NULL && (rx == rts || rx == cts || rx == rs485_dir)) ||
(rts != NULL && (rts == cts || rts == rs485_dir)) ||
(cts != NULL && (cts == rs485_dir))) {
raise_ValueError_invalid_pins();
}
uint8_t bits = (uint8_t)mp_arg_validate_int_range(args[ARG_bits].u_int, 5, 9, MP_QSTR_bits);
uint16_t buffer_size = (uint16_t)mp_arg_validate_int_range(args[ARG_receiver_buffer_size].u_int, 1, 0xffff, MP_QSTR_receiver_buffer_size);
busio_uart_parity_t parity = BUSIO_UART_PARITY_NONE;
if (args[ARG_parity].u_obj == MP_OBJ_FROM_PTR(&busio_uart_parity_even_obj)) {
parity = BUSIO_UART_PARITY_EVEN;
} else if (args[ARG_parity].u_obj == MP_OBJ_FROM_PTR(&busio_uart_parity_odd_obj)) {
parity = BUSIO_UART_PARITY_ODD;
}
uint8_t stop = (uint8_t)mp_arg_validate_int_range(args[ARG_stop].u_int, 1, 2, MP_QSTR_stop);
mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj);
validate_timeout(timeout);
const bool rs485_invert = args[ARG_rs485_invert].u_bool;
busio_uart_obj_t *self = mp_obj_malloc_with_finaliser(busio_uart_obj_t, &busio_uart_type);
common_hal_busio_uart_construct(self, tx, rx, rts, cts, rs485_dir, rs485_invert,
args[ARG_baudrate].u_int, bits, parity, stop, timeout,
buffer_size, NULL, false);
return (mp_obj_t)self;
#else
mp_raise_NotImplementedError(NULL);
#endif // CIRCUITPY_BUSIO_UART
}
#if CIRCUITPY_BUSIO_UART
// Helper to ensure we have the native super class instead of a subclass.
static busio_uart_obj_t *native_uart(mp_obj_t uart_obj) {
mp_obj_t native_uart = mp_obj_cast_to_native_base(uart_obj, MP_OBJ_FROM_PTR(&busio_uart_type));
if (native_uart == MP_OBJ_NULL) {
mp_raise_ValueError_varg(MP_ERROR_TEXT("Must be a %q subclass."), MP_QSTR_UART);
}
mp_obj_assert_native_inited(native_uart);
return MP_OBJ_TO_PTR(native_uart);
}
//| def deinit(self) -> None:
//| """Deinitialises the UART and releases any hardware resources for reuse."""
//| ...
static mp_obj_t busio_uart_obj_deinit(mp_obj_t self_in) {
busio_uart_obj_t *self = native_uart(self_in);
common_hal_busio_uart_deinit(self);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_deinit_obj, busio_uart_obj_deinit);
static void check_for_deinit(busio_uart_obj_t *self) {
if (common_hal_busio_uart_deinited(self)) {
raise_deinited_error();
}
}
//| def __enter__(self) -> UART:
//| """No-op used by Context Managers."""
//| ...
// Provided by context manager helper.
//| def __exit__(self) -> None:
//| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
static mp_obj_t busio_uart_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
common_hal_busio_uart_deinit(MP_OBJ_TO_PTR(args[0]));
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_uart_obj___exit__);
// These are standard stream methods. Code is in py/stream.c.
//
//| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]:
//| """Read bytes. If ``nbytes`` is specified then read at most that many
//| bytes. Otherwise, read everything that arrives until the connection
//| times out. Providing the number of bytes expected is highly recommended
//| because it will be faster. If no bytes are read, return ``None``.
//|
//| .. note:: When no bytes are read due to a timeout, this function returns ``None``.
//| This matches the behavior of `io.RawIOBase.read` in Python 3, but
//| differs from pyserial which returns ``b''`` in that situation.
//|
//| :return: Data read
//| :rtype: bytes or None"""
//| ...
//| def readinto(self, buf: WriteableBuffer) -> Optional[int]:
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
//|
//| :return: number of bytes read and stored into ``buf``
//| :rtype: int or None (on a non-blocking error)
//|
//| *New in CircuitPython 4.0:* No length parameter is permitted."""
//| ...
//| def readline(self) -> bytes:
//| """Read a line, ending in a newline character, or
//| return ``None`` if a timeout occurs sooner, or
//| return everything readable if no newline is found and
//| ``timeout=0``
//|
//| :return: the line read
//| :rtype: bytes or None"""
//| ...
//| def write(self, buf: ReadableBuffer) -> Optional[int]:
//| """Write the buffer of bytes to the bus.
//|
//| *New in CircuitPython 4.0:* ``buf`` must be bytes, not a string.
//|
//| :return: the number of bytes written
//| :rtype: int or None"""
//| ...
// These three methods are used by the shared stream methods.
static mp_uint_t busio_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) {
STREAM_DEBUG("busio_uart_read stream %d\n", size);
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
byte *buf = buf_in;
// make sure we want at least 1 char
if (size == 0) {
return 0;
}
return common_hal_busio_uart_read(self, buf, size, errcode);
}
static mp_uint_t busio_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) {
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
const byte *buf = buf_in;
return common_hal_busio_uart_write(self, buf, size, errcode);
}
static mp_uint_t busio_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
mp_uint_t ret;
if (request == MP_STREAM_POLL) {
mp_uint_t flags = arg;
ret = 0;
if ((flags & MP_STREAM_POLL_RD) && common_hal_busio_uart_rx_characters_available(self) > 0) {
ret |= MP_STREAM_POLL_RD;
}
if ((flags & MP_STREAM_POLL_WR) && common_hal_busio_uart_ready_to_tx(self)) {
ret |= MP_STREAM_POLL_WR;
}
} else {
*errcode = MP_EINVAL;
ret = MP_STREAM_ERROR;
}
return ret;
}
//| baudrate: int
//| """The current baudrate."""
static mp_obj_t busio_uart_obj_get_baudrate(mp_obj_t self_in) {
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
return MP_OBJ_NEW_SMALL_INT(common_hal_busio_uart_get_baudrate(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_get_baudrate_obj, busio_uart_obj_get_baudrate);
static mp_obj_t busio_uart_obj_set_baudrate(mp_obj_t self_in, mp_obj_t baudrate) {
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
common_hal_busio_uart_set_baudrate(self, mp_obj_get_int(baudrate));
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(busio_uart_set_baudrate_obj, busio_uart_obj_set_baudrate);
MP_PROPERTY_GETSET(busio_uart_baudrate_obj,
(mp_obj_t)&busio_uart_get_baudrate_obj,
(mp_obj_t)&busio_uart_set_baudrate_obj);
//| in_waiting: int
//| """The number of bytes in the input buffer, available to be read"""
static mp_obj_t busio_uart_obj_get_in_waiting(mp_obj_t self_in) {
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
return MP_OBJ_NEW_SMALL_INT(common_hal_busio_uart_rx_characters_available(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_get_in_waiting_obj, busio_uart_obj_get_in_waiting);
MP_PROPERTY_GETTER(busio_uart_in_waiting_obj,
(mp_obj_t)&busio_uart_get_in_waiting_obj);
//| timeout: float
//| """The current timeout, in seconds (float)."""
static mp_obj_t busio_uart_obj_get_timeout(mp_obj_t self_in) {
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
return mp_obj_new_float(common_hal_busio_uart_get_timeout(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_get_timeout_obj, busio_uart_obj_get_timeout);
static mp_obj_t busio_uart_obj_set_timeout(mp_obj_t self_in, mp_obj_t timeout) {
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
mp_float_t timeout_float = mp_obj_get_float(timeout);
validate_timeout(timeout_float);
common_hal_busio_uart_set_timeout(self, timeout_float);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(busio_uart_set_timeout_obj, busio_uart_obj_set_timeout);
MP_PROPERTY_GETSET(busio_uart_timeout_obj,
(mp_obj_t)&busio_uart_get_timeout_obj,
(mp_obj_t)&busio_uart_set_timeout_obj);
//| def reset_input_buffer(self) -> None:
//| """Discard any unread characters in the input buffer."""
//| ...
//|
static mp_obj_t busio_uart_obj_reset_input_buffer(mp_obj_t self_in) {
busio_uart_obj_t *self = native_uart(self_in);
check_for_deinit(self);
common_hal_busio_uart_clear_rx_buffer(self);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_reset_input_buffer_obj, busio_uart_obj_reset_input_buffer);
//| class Parity:
//| """Enum-like class to define the parity used to verify correct data transfer."""
//|
//| ODD: int
//| """Total number of ones should be odd."""
//|
//| EVEN: int
//| """Total number of ones should be even."""
//|
const mp_obj_type_t busio_uart_parity_type;
const busio_uart_parity_obj_t busio_uart_parity_odd_obj = {
{ &busio_uart_parity_type },
};
const busio_uart_parity_obj_t busio_uart_parity_even_obj = {
{ &busio_uart_parity_type },
};
static const mp_rom_map_elem_t busio_uart_parity_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ODD), MP_ROM_PTR(&busio_uart_parity_odd_obj) },
{ MP_ROM_QSTR(MP_QSTR_EVEN), MP_ROM_PTR(&busio_uart_parity_even_obj) },
};
static MP_DEFINE_CONST_DICT(busio_uart_parity_locals_dict, busio_uart_parity_locals_dict_table);
static void busio_uart_parity_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
qstr parity = MP_QSTR_ODD;
if (self_in == MP_ROM_PTR(&busio_uart_parity_even_obj)) {
parity = MP_QSTR_EVEN;
}
mp_printf(print, "%q.%q.%q.%q", MP_QSTR_busio, MP_QSTR_UART, MP_QSTR_Parity, parity);
}
MP_DEFINE_CONST_OBJ_TYPE(
busio_uart_parity_type,
MP_QSTR_Parity,
MP_TYPE_FLAG_NONE,
print, busio_uart_parity_print,
locals_dict, &busio_uart_parity_locals_dict
);
#endif // CIRCUITPY_BUSIO_UART
static const mp_rom_map_elem_t busio_uart_locals_dict_table[] = {
#if CIRCUITPY_BUSIO_UART
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&busio_uart_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&busio_uart_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&busio_uart___exit___obj) },
// Standard stream methods.
{ MP_OBJ_NEW_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj)},
{ MP_OBJ_NEW_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset_input_buffer), MP_ROM_PTR(&busio_uart_reset_input_buffer_obj) },
// Properties
{ MP_ROM_QSTR(MP_QSTR_baudrate), MP_ROM_PTR(&busio_uart_baudrate_obj) },
{ MP_ROM_QSTR(MP_QSTR_in_waiting), MP_ROM_PTR(&busio_uart_in_waiting_obj) },
{ MP_ROM_QSTR(MP_QSTR_timeout), MP_ROM_PTR(&busio_uart_timeout_obj) },
// Nested Enum-like Classes.
{ MP_ROM_QSTR(MP_QSTR_Parity), MP_ROM_PTR(&busio_uart_parity_type) },
#endif // CIRCUITPY_BUSIO_UART
};
static MP_DEFINE_CONST_DICT(busio_uart_locals_dict, busio_uart_locals_dict_table);
#if CIRCUITPY_BUSIO_UART
static const mp_stream_p_t uart_stream_p = {
.read = busio_uart_read,
.write = busio_uart_write,
.ioctl = busio_uart_ioctl,
.is_text = false,
// Disallow optional length argument for .readinto()
.pyserial_readinto_compatibility = true,
};
MP_DEFINE_CONST_OBJ_TYPE(
busio_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_ITER_IS_ITERNEXT | MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS,
make_new, busio_uart_make_new,
locals_dict, &busio_uart_locals_dict,
iter, mp_stream_unbuffered_iter,
protocol, &uart_stream_p
);
#else
MP_DEFINE_CONST_OBJ_TYPE(
busio_uart_type,
MP_QSTR_UART,
MP_TYPE_FLAG_NONE,
make_new, busio_uart_make_new,
locals_dict, &busio_uart_locals_dict
);
#endif // CIRCUITPY_BUSIO_UART