@@ -117,11 +117,19 @@ static rt_err_t pico_uart_configure(struct rt_serial_device *serial, struct seri
117117 gpio_set_function (uart -> rx_pin , GPIO_FUNC_UART );
118118 gpio_set_function (uart -> tx_pin , GPIO_FUNC_UART );
119119
120- // Set UART flow control CTS/RTS, we don't want these, so turn them off
121- uart_set_hw_flow (uart -> instance , false, false);
120+ // Set UART flow control CTS/RTS
121+ if (cfg -> flowcontrol == RT_SERIAL_FLOWCONTROL_CTSRTS )
122+ uart_set_hw_flow (uart -> instance , true, true);
123+ else
124+ uart_set_hw_flow (uart -> instance , false, false);
122125
123126 // Set our data format
124- uart_set_format (uart -> instance , cfg -> data_bits , cfg -> stop_bits , UART_PARITY_NONE );
127+ uart_parity_t uart_parity = UART_PARITY_NONE ;
128+ if (cfg -> parity == PARITY_ODD )
129+ uart_parity = UART_PARITY_ODD ;
130+ else if (cfg -> parity == PARITY_EVEN )
131+ uart_parity = UART_PARITY_EVEN ;
132+ uart_set_format (uart -> instance , cfg -> data_bits , cfg -> stop_bits , uart_parity );
125133
126134 // Turn off FIFO's - we want to do this character by character
127135 uart_set_fifo_enabled (uart -> instance , false);
0 commit comments