Skip to content

Commit d09b302

Browse files
authored
Merge pull request #872 from david-cermak/fix/eppp_minor_fixes
[eppp]: Minor fixes v1.0
2 parents 39e2333 + cd57f1b commit d09b302

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

components/eppp_link/eppp_netif_tun.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ esp_err_t eppp_check_connection(esp_netif_t *netif)
167167
{
168168
esp_err_t ret = ESP_OK;
169169
esp_ping_config_t config = ESP_PING_DEFAULT_CONFIG();
170+
#if CONFIG_LOG_MAXIMUM_LEVEL > 3
171+
config.task_stack_size += 1024; // Some additional stack needed for verbose logs
172+
#endif
170173
config.count = 100;
171174
ESP_LOGI(TAG, "Checking connection on EPPP interface #%" PRIu32, config.interface);
172175
ip_addr_t target_addr = {0};

components/eppp_link/eppp_spi.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ static esp_err_t init_master(struct eppp_config_spi_s *config, struct eppp_spi *
208208
};
209209

210210
ESP_GOTO_ON_ERROR(gpio_config(&io_conf), err_dev, TAG, "Failed to config interrupt GPIO");
211-
ESP_GOTO_ON_ERROR(gpio_install_isr_service(0), err_dev, TAG, "Failed to install GPIO ISR");
211+
ret = gpio_install_isr_service(0);
212+
ESP_GOTO_ON_FALSE(ret == ESP_OK || ret == ESP_ERR_INVALID_STATE /* In case the GPIO ISR already installed */,
213+
ret, err_dev, TAG, "Failed to install GPIO ISR");
212214
ESP_GOTO_ON_ERROR(gpio_set_intr_type(config->intr, GPIO_INTR_ANYEDGE), err_dev, TAG, "Failed to set ISR type");
213215
ESP_GOTO_ON_ERROR(gpio_isr_handler_add(config->intr, gpio_isr_handler, h), err_dev, TAG, "Failed to add ISR handler");
214216
return ESP_OK;
@@ -468,9 +470,6 @@ eppp_transport_handle_t eppp_spi_init(struct eppp_config_spi_s *config)
468470
if (h->ready_semaphore) {
469471
vSemaphoreDelete(h->ready_semaphore);
470472
}
471-
if (h->out_queue) {
472-
vQueueDelete(h->out_queue);
473-
}
474473
free(h);
475474
return NULL;
476475
}

components/eppp_link/eppp_uart.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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;
271271
err:
272+
free(h);
272273
return NULL;
273274
}
274275

components/eppp_link/include/eppp_link.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ extern "C" {
3434
.rx_io = 26, \
3535
.queue_size = 16, \
3636
.rx_buffer_size = 1024, \
37+
.rts_io = -1, \
38+
.cts_io = -1, \
39+
.flow_control = 0, \
3740
}, \
3841

3942
#define EPPP_DEFAULT_SDIO_CONFIG() \
@@ -135,6 +138,9 @@ typedef struct eppp_config_t {
135138
int rx_io;
136139
int queue_size;
137140
int rx_buffer_size;
141+
int rts_io;
142+
int cts_io;
143+
int flow_control;
138144
} uart;
139145

140146
struct eppp_config_sdio_s {

0 commit comments

Comments
 (0)