|
69 | 69 | #define MAX_BUFFER_SIZE (32766)
|
70 | 70 |
|
71 | 71 | #define IS_VALID_PERIPH(uart, pin) (((((pin) + 4) & 8) >> 3) == (uart))
|
| 72 | +#if PICO_RP2350 |
| 73 | +#define IS_VALID_TX(uart, pin) (((pin) & 1) == 0 && IS_VALID_PERIPH(uart, pin)) |
| 74 | +#define IS_VALID_RX(uart, pin) (((pin) & 1) == 1 && IS_VALID_PERIPH(uart, pin)) |
| 75 | +#else |
72 | 76 | #define IS_VALID_TX(uart, pin) (((pin) & 3) == 0 && IS_VALID_PERIPH(uart, pin))
|
73 | 77 | #define IS_VALID_RX(uart, pin) (((pin) & 3) == 1 && IS_VALID_PERIPH(uart, pin))
|
| 78 | +#endif |
74 | 79 | #define IS_VALID_CTS(uart, pin) (((pin) & 3) == 2 && IS_VALID_PERIPH(uart, pin))
|
75 | 80 | #define IS_VALID_RTS(uart, pin) (((pin) & 3) == 3 && IS_VALID_PERIPH(uart, pin))
|
76 | 81 |
|
@@ -398,8 +403,8 @@ static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
|
398 | 403 | __dsb(); // make sure UARTLCR_H register is written to
|
399 | 404 | uart_set_fifo_enabled(self->uart, true);
|
400 | 405 | __dsb(); // make sure UARTLCR_H register is written to
|
401 |
| - gpio_set_function(self->tx, GPIO_FUNC_UART); |
402 |
| - gpio_set_function(self->rx, GPIO_FUNC_UART); |
| 406 | + gpio_set_function(self->tx, UART_FUNCSEL_NUM(self->uart, self->tx)); |
| 407 | + gpio_set_function(self->rx, UART_FUNCSEL_NUM(self->uart, self->rx)); |
403 | 408 | if (self->invert & UART_INVERT_RX) {
|
404 | 409 | gpio_set_inover(self->rx, GPIO_OVERRIDE_INVERT);
|
405 | 410 | }
|
|
0 commit comments