Merge pull request #7605 from Neradoc/pico-uart-in-use-error

Tweak the UART in use message on RP2040
This commit is contained in:
MicroDev 2023-02-18 08:35:52 +05:30 committed by GitHub
commit 508f2015b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -450,7 +450,6 @@ msgid "All SPI peripherals are in use"
msgstr ""
#: ports/espressif/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
#: ports/raspberrypi/common-hal/busio/UART.c
msgid "All UART peripherals are in use"
msgstr ""
@ -2111,6 +2110,10 @@ msgstr ""
msgid "UART init"
msgstr ""
#: ports/raspberrypi/common-hal/busio/UART.c
msgid "UART peripheral in use"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "UART re-init"
msgstr ""

View File

@ -111,7 +111,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
uint8_t uart_id = ((((tx != NULL) ? tx->number : rx->number) + 4) / 8) % NUM_UARTS;
if (uart_status[uart_id] != STATUS_FREE) {
mp_raise_RuntimeError(translate("All UART peripherals are in use"));
mp_raise_ValueError(translate("UART peripheral in use"));
}
// These may raise exceptions if pins are already in use.
self->tx_pin = pin_init(uart_id, tx, 0);