@@ -80,12 +80,12 @@ static esp_err_t init_uart(struct eppp_uart *h, struct eppp_config_uart_s *confi
8080 uart_config .data_bits = UART_DATA_8_BITS ;
8181 uart_config .parity = UART_PARITY_DISABLE ;
8282 uart_config .stop_bits = UART_STOP_BITS_1 ;
83- uart_config .flow_ctrl = UART_HW_FLOWCTRL_DISABLE ;
83+ uart_config .flow_ctrl = config -> flow_control ;
8484 uart_config .source_clk = UART_SCLK_DEFAULT ;
8585
8686 ESP_RETURN_ON_ERROR (uart_driver_install (h -> uart_port , config -> rx_buffer_size , 0 , config -> queue_size , & h -> uart_event_queue , 0 ), TAG , "Failed to install UART" );
8787 ESP_RETURN_ON_ERROR (uart_param_config (h -> uart_port , & uart_config ), TAG , "Failed to set params" );
88- ESP_RETURN_ON_ERROR (uart_set_pin (h -> uart_port , config -> tx_io , config -> rx_io , UART_PIN_NO_CHANGE , UART_PIN_NO_CHANGE ), TAG , "Failed to set UART pins" );
88+ ESP_RETURN_ON_ERROR (uart_set_pin (h -> uart_port , config -> tx_io , config -> rx_io , config -> rts_io , config -> cts_io ), TAG , "Failed to set UART pins" );
8989 ESP_RETURN_ON_ERROR (uart_set_rx_timeout (h -> uart_port , 1 ), TAG , "Failed to set UART Rx timeout" );
9090 return ESP_OK ;
9191}
@@ -269,6 +269,7 @@ eppp_transport_handle_t eppp_uart_init(struct eppp_config_uart_s *config)
269269 ESP_GOTO_ON_ERROR (init_uart (h , config ), err , TAG , "Failed to init UART" );
270270 return & h -> parent ;
271271err :
272+ free (h );
272273 return NULL ;
273274}
274275
0 commit comments