Skip to content

Commit f5ce3f7

Browse files
Guard ethernet parts to make it possible to use without (#10609)
* Update ETH.cpp * Update ETH.h * Update WiFiGeneric.h * Update NetworkEvents.h * remove unnecessary include "sdkconfig.h" * ci(pre-commit): Apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 2b6b5c7 commit f5ce3f7

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

libraries/Ethernet/src/ETH.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define ARDUINO_CORE_BUILD
2323

2424
#include "ETH.h"
25+
#if CONFIG_ETH_ENABLED
2526
#include "esp_system.h"
2627
#include "esp_event.h"
2728
#include "esp_eth.h"
@@ -1056,3 +1057,5 @@ size_t ETHClass::printDriverInfo(Print &out) const {
10561057
}
10571058

10581059
ETHClass ETH;
1060+
1061+
#endif /* CONFIG_ETH_ENABLED */

libraries/Ethernet/src/ETH.h

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1919
*/
2020

21+
#include "sdkconfig.h"
22+
#if CONFIG_ETH_ENABLED
23+
2124
#ifndef _ETH_H_
2225
#define _ETH_H_
2326

@@ -249,3 +252,4 @@ class ETHClass : public NetworkInterface {
249252
extern ETHClass ETH;
250253

251254
#endif /* _ETH_H_ */
255+
#endif /* CONFIG_ETH_ENABLED */

libraries/Network/src/NetworkEvents.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
*/
66
#pragma once
77

8+
#include "sdkconfig.h"
89
#include "soc/soc_caps.h"
910
#include "esp_err.h"
1011
#include "esp_event.h"
1112
#include "esp_netif_types.h"
13+
#if CONFIG_ETH_ENABLED
1214
#include "esp_eth_driver.h"
15+
#endif
1316
#include <functional>
1417
#include "freertos/FreeRTOS.h"
1518
#include "freertos/task.h"
1619
#include "freertos/queue.h"
1720
#include "freertos/semphr.h"
1821
#include "freertos/event_groups.h"
19-
#include "sdkconfig.h"
2022
#if defined NETWORK_EVENTS_MUTEX && SOC_CPU_CORES_NUM > 1
2123
#include <mutex>
2224
#endif // defined NETWORK_EVENTS_MUTEX && SOC_CPU_CORES_NUM > 1
@@ -98,7 +100,9 @@ typedef union {
98100
ip_event_ap_staipassigned_t wifi_ap_staipassigned;
99101
ip_event_got_ip_t got_ip;
100102
ip_event_got_ip6_t got_ip6;
103+
#if CONFIG_ETH_ENABLED
101104
esp_eth_handle_t eth_connected;
105+
#endif
102106
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
103107
wifi_event_sta_scan_done_t wifi_scan_done;
104108
wifi_event_sta_authmode_change_t wifi_sta_authmode_change;

libraries/WiFi/src/WiFiGeneric.h

+2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
#include "IPAddress.h"
3434
#include "esp_smartconfig.h"
3535
#include "esp_netif_types.h"
36+
#if CONFIG_ETH_ENABLED
3637
#include "esp_eth_driver.h"
38+
#endif
3739
#if CONFIG_NETWORK_PROV_NETWORK_TYPE_WIFI
3840
#include "network_provisioning/manager.h"
3941
#endif

0 commit comments

Comments
 (0)