/* Configure UART parameters in single call. 
Any pin number can be set to 0xff (or any number larger than UART_MAX_PIN) to disconnect that pin. */
void uart_configure(uint32_t uart, uint32_t tx_pin, uint32_t rx_pin, uint32_t rts_pin, uint32_t cts_pin, enum uart_baud br, bool enable_parity)
/* Configure UART parameters in single call. 
Any pin number can be set to 0xff (or any number larger than UART_MAX_PIN) to disconnect that pin. */
void uart_configure(uint32_t uart, uint32_t tx_pin, uint32_t rx_pin, uint32_t rts_pin, uint32_t cts_pin, enum uart_baud br, bool enable_parity)
{
    uart_set_pins(uart, rx_pin, tx_pin, cts_pin, rts_pin);
    uint32_t reg_config = enable_parity ? UART_CONFIG_PARITY : 0;
    if (rts_pin <= UART_MAX_PIN || cts_pin <= UART_MAX_PIN) {
        reg_config |= UART_CONFIG_HWFC;
    }
    UART_CONFIG(uart) = reg_config;
    uart_set_baudrate(uart, br);
}