Avoid generating garbage input due to initialization (#1125)
First mapping the GPIO pins to the UART peripheral before enabling the UART peripheral avoids generation of garbage character on the UART's input.
This commit is contained in:
parent
13a171a971
commit
35787255af
@ -70,9 +70,9 @@ void stdin_uart_init() {
|
|||||||
|
|
||||||
void stdio_uart_init_full(struct uart_inst *uart, uint baud_rate, int tx_pin, int rx_pin) {
|
void stdio_uart_init_full(struct uart_inst *uart, uint baud_rate, int tx_pin, int rx_pin) {
|
||||||
uart_instance = uart;
|
uart_instance = uart;
|
||||||
uart_init(uart_instance, baud_rate);
|
|
||||||
if (tx_pin >= 0) gpio_set_function((uint)tx_pin, GPIO_FUNC_UART);
|
if (tx_pin >= 0) gpio_set_function((uint)tx_pin, GPIO_FUNC_UART);
|
||||||
if (rx_pin >= 0) gpio_set_function((uint)rx_pin, GPIO_FUNC_UART);
|
if (rx_pin >= 0) gpio_set_function((uint)rx_pin, GPIO_FUNC_UART);
|
||||||
|
uart_init(uart_instance, baud_rate);
|
||||||
stdio_set_driver_enabled(&stdio_uart, true);
|
stdio_set_driver_enabled(&stdio_uart, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user