I'm not that strong on C but it seems like the code below prevents changing the pins for UART0.
Does anyone know the background to this, is there an underlying reason why UART0 can't be used on the esp32 family?
Thanks
machine_uart.c
Code: Select all
STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
switch (uart_num) {
case UART_NUM_0:
self->rx = UART_PIN_NO_CHANGE; // GPIO 3
self->tx = UART_PIN_NO_CHANGE; // GPIO 1
break;
case UART_NUM_1:
self->rx = 9;
self->tx = 10;
break;
#if SOC_UART_NUM > 2
case UART_NUM_2:
self->rx = 16;
self->tx = 17;
break;
#endif
}
// Only reset the driver if it's not the REPL UART.
if (uart_num != MICROPY_HW_UART_REPL) {
// Remove any existing configuration
uart_driver_delete(self->uart_num);
// init the peripheral
// Setup
uart_param_config(self->uart_num, &uartcfg);
uart_driver_install(uart_num, self->rxbuf, self->txbuf, 0, NULL, 0);
}