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>
This commit is contained in:
Jason2866 2024-11-19 11:19:02 +01:00 committed by GitHub
parent 2b6b5c74ce
commit f5ce3f7675
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 1 deletions

View file

@ -22,6 +22,7 @@
#define ARDUINO_CORE_BUILD #define ARDUINO_CORE_BUILD
#include "ETH.h" #include "ETH.h"
#if CONFIG_ETH_ENABLED
#include "esp_system.h" #include "esp_system.h"
#include "esp_event.h" #include "esp_event.h"
#include "esp_eth.h" #include "esp_eth.h"
@ -1056,3 +1057,5 @@ size_t ETHClass::printDriverInfo(Print &out) const {
} }
ETHClass ETH; ETHClass ETH;
#endif /* CONFIG_ETH_ENABLED */

View file

@ -18,6 +18,9 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "sdkconfig.h"
#if CONFIG_ETH_ENABLED
#ifndef _ETH_H_ #ifndef _ETH_H_
#define _ETH_H_ #define _ETH_H_
@ -249,3 +252,4 @@ private:
extern ETHClass ETH; extern ETHClass ETH;
#endif /* _ETH_H_ */ #endif /* _ETH_H_ */
#endif /* CONFIG_ETH_ENABLED */

View file

@ -5,18 +5,20 @@
*/ */
#pragma once #pragma once
#include "sdkconfig.h"
#include "soc/soc_caps.h" #include "soc/soc_caps.h"
#include "esp_err.h" #include "esp_err.h"
#include "esp_event.h" #include "esp_event.h"
#include "esp_netif_types.h" #include "esp_netif_types.h"
#if CONFIG_ETH_ENABLED
#include "esp_eth_driver.h" #include "esp_eth_driver.h"
#endif
#include <functional> #include <functional>
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/queue.h" #include "freertos/queue.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "freertos/event_groups.h" #include "freertos/event_groups.h"
#include "sdkconfig.h"
#if defined NETWORK_EVENTS_MUTEX && SOC_CPU_CORES_NUM > 1 #if defined NETWORK_EVENTS_MUTEX && SOC_CPU_CORES_NUM > 1
#include <mutex> #include <mutex>
#endif // defined NETWORK_EVENTS_MUTEX && SOC_CPU_CORES_NUM > 1 #endif // defined NETWORK_EVENTS_MUTEX && SOC_CPU_CORES_NUM > 1
@ -98,7 +100,9 @@ typedef union {
ip_event_ap_staipassigned_t wifi_ap_staipassigned; ip_event_ap_staipassigned_t wifi_ap_staipassigned;
ip_event_got_ip_t got_ip; ip_event_got_ip_t got_ip;
ip_event_got_ip6_t got_ip6; ip_event_got_ip6_t got_ip6;
#if CONFIG_ETH_ENABLED
esp_eth_handle_t eth_connected; esp_eth_handle_t eth_connected;
#endif
#if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED #if SOC_WIFI_SUPPORTED || CONFIG_ESP_WIFI_REMOTE_ENABLED
wifi_event_sta_scan_done_t wifi_scan_done; wifi_event_sta_scan_done_t wifi_scan_done;
wifi_event_sta_authmode_change_t wifi_sta_authmode_change; wifi_event_sta_authmode_change_t wifi_sta_authmode_change;

View file

@ -33,7 +33,9 @@
#include "IPAddress.h" #include "IPAddress.h"
#include "esp_smartconfig.h" #include "esp_smartconfig.h"
#include "esp_netif_types.h" #include "esp_netif_types.h"
#if CONFIG_ETH_ENABLED
#include "esp_eth_driver.h" #include "esp_eth_driver.h"
#endif
#if CONFIG_NETWORK_PROV_NETWORK_TYPE_WIFI #if CONFIG_NETWORK_PROV_NETWORK_TYPE_WIFI
#include "network_provisioning/manager.h" #include "network_provisioning/manager.h"
#endif #endif