We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6346b9b + 9b82586 commit 46c0436Copy full SHA for 46c0436
ports/raspberrypi/common-hal/busio/UART.c
@@ -120,14 +120,14 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
120
121
if (uart_status[uart_id] != STATUS_FREE) {
122
mp_raise_RuntimeError(translate("All UART peripherals are in use"));
123
- } else {
124
- uart_status[uart_id] = STATUS_BUSY;
125
}
126
-
+ // These may raise exceptions if pins are already in use.
127
self->tx_pin = pin_init(uart_id, tx, 0);
128
self->rx_pin = pin_init(uart_id, rx, 1);
129
self->cts_pin = pin_init(uart_id, cts, 2);
130
self->rts_pin = pin_init(uart_id, rts, 3);
+ uart_status[uart_id] = STATUS_BUSY;
+
131
132
self->uart = UART_INST(uart_id);
133
self->uart_id = uart_id;
0 commit comments