mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-11-24 03:09:32 +01:00
fix(examples): Add optional return for low level netif input
Also fixes driver/uart-driver dependency
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
# SLIP Modem Component
|
||||
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER "5.3")
|
||||
set(dependencies esp_driver_uart)
|
||||
else()
|
||||
set(dependencies driver)
|
||||
endif()
|
||||
|
||||
idf_component_register(
|
||||
SRCS "library/slip_modem.c" "library/slip_modem_netif.c"
|
||||
INCLUDE_DIRS "include"
|
||||
REQUIRES esp_netif driver
|
||||
REQUIRES esp_netif ${dependencies}
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -53,10 +53,18 @@ esp_err_t slip_modem_netif_start(esp_netif_t *esp_netif, esp_ip6_addr_t *addr)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS)
|
||||
typedef esp_err_t esp_netif_recv_ret_t;
|
||||
#define ESP_NETIF_OPTIONAL_RETURN_CODE(expr) expr
|
||||
#else
|
||||
typedef void esp_netif_recv_ret_t;
|
||||
#define ESP_NETIF_OPTIONAL_RETURN_CODE(expr)
|
||||
#endif // CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS
|
||||
|
||||
/**
|
||||
* @brief Write incoming serial data to the SLIP interface
|
||||
*/
|
||||
void esp_netif_lwip_slip_input(void *h, void *buffer, unsigned int len, void *eb)
|
||||
esp_netif_recv_ret_t esp_netif_lwip_slip_input(void *h, void *buffer, unsigned int len, void *eb)
|
||||
{
|
||||
struct netif *netif = h;
|
||||
|
||||
@@ -76,6 +84,7 @@ void esp_netif_lwip_slip_input(void *h, void *buffer, unsigned int len, void *eb
|
||||
for (int i = 0; i < len; i++) {
|
||||
slipif_process_rxqueue(netif);
|
||||
}
|
||||
return ESP_NETIF_OPTIONAL_RETURN_CODE(ESP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user