Skip to content

Commit

Permalink
Merge pull request #5834 from adafruit/rpi-uart-claim-later
Browse files Browse the repository at this point in the history
raspberrypi: Claim UART after checking pins
  • Loading branch information
tannewt authored Jan 12, 2022
2 parents 6346b9b + 9b82586 commit 46c0436
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ports/raspberrypi/common-hal/busio/UART.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,

if (uart_status[uart_id] != STATUS_FREE) {
mp_raise_RuntimeError(translate("All UART peripherals are in use"));
} else {
uart_status[uart_id] = STATUS_BUSY;
}

// These may raise exceptions if pins are already in use.
self->tx_pin = pin_init(uart_id, tx, 0);
self->rx_pin = pin_init(uart_id, rx, 1);
self->cts_pin = pin_init(uart_id, cts, 2);
self->rts_pin = pin_init(uart_id, rts, 3);
uart_status[uart_id] = STATUS_BUSY;


self->uart = UART_INST(uart_id);
self->uart_id = uart_id;
Expand Down

0 comments on commit 46c0436

Please sign in to comment.