diff --git a/components/eppp_link/eppp_uart.c b/components/eppp_link/eppp_uart.c index 75283aa58..6d89d18ba 100644 --- a/components/eppp_link/eppp_uart.c +++ b/components/eppp_link/eppp_uart.c @@ -80,12 +80,12 @@ static esp_err_t init_uart(struct eppp_uart *h, struct eppp_config_uart_s *confi uart_config.data_bits = UART_DATA_8_BITS; uart_config.parity = UART_PARITY_DISABLE; uart_config.stop_bits = UART_STOP_BITS_1; - uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE; + uart_config.flow_ctrl = config->flow_control; uart_config.source_clk = UART_SCLK_DEFAULT; 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"); ESP_RETURN_ON_ERROR(uart_param_config(h->uart_port, &uart_config), TAG, "Failed to set params"); - 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"); + 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"); ESP_RETURN_ON_ERROR(uart_set_rx_timeout(h->uart_port, 1), TAG, "Failed to set UART Rx timeout"); return ESP_OK; } @@ -269,6 +269,7 @@ eppp_transport_handle_t eppp_uart_init(struct eppp_config_uart_s *config) ESP_GOTO_ON_ERROR(init_uart(h, config), err, TAG, "Failed to init UART"); return &h->parent; err: + free(h); return NULL; } diff --git a/components/eppp_link/include/eppp_link.h b/components/eppp_link/include/eppp_link.h index 3df11c4d8..4d6766e30 100644 --- a/components/eppp_link/include/eppp_link.h +++ b/components/eppp_link/include/eppp_link.h @@ -34,6 +34,9 @@ extern "C" { .rx_io = 26, \ .queue_size = 16, \ .rx_buffer_size = 1024, \ + .rts_io = -1, \ + .cts_io = -1, \ + .flow_control = 0, \ }, \ #define EPPP_DEFAULT_SDIO_CONFIG() \ @@ -135,6 +138,9 @@ typedef struct eppp_config_t { int rx_io; int queue_size; int rx_buffer_size; + int rts_io; + int cts_io; + int flow_control; } uart; struct eppp_config_sdio_s {