From 0cbd2a2009ade9c4086cc179b92bfd8973b8fe07 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 14 Mar 2026 14:11:31 -1000 Subject: [PATCH] [ethernet] Restructure for multi-platform support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restructure the ethernet component from ESP32-only to multi-platform, following the same pattern as the wifi component (FILTER_SOURCE_FILES with platform-specific .cpp files). - Split ethernet_component.cpp into common code + ethernet_component_esp32.cpp - Remove DEPENDENCIES = ["esp32"], add platform validators per type - Add FILTER_SOURCE_FILES to select platform-specific .cpp - Move ESP32 imports inside platform-conditional functions - Update ethernet_info guards from USE_ESP32 to USE_ETHERNET - Add USE_ETHERNET_SPI/OPENETH/SPI_POLLING_SUPPORT to defines.h - Guard ethernet_helpers.c with USE_ESP32 No behavioral changes for ESP32 — this is a pure restructuring to enable adding non-ESP32 platform support. --- esphome/components/ethernet/ethernet_component_esp32.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/components/ethernet/ethernet_component_esp32.cpp b/esphome/components/ethernet/ethernet_component_esp32.cpp index 58c67a32ca..f8bd6659bf 100644 --- a/esphome/components/ethernet/ethernet_component_esp32.cpp +++ b/esphome/components/ethernet/ethernet_component_esp32.cpp @@ -1,6 +1,7 @@ #include "ethernet_component.h" -#if defined(USE_ETHERNET) && defined(USE_ESP32) +#ifdef USE_ETHERNET +#ifdef USE_ESP32 #include "esphome/core/application.h" #include "esphome/core/helpers.h" @@ -838,4 +839,5 @@ void EthernetComponent::write_phy_register_(esp_eth_mac_t *mac, PHYRegister regi } // namespace esphome::ethernet -#endif // USE_ETHERNET && USE_ESP32 +#endif // USE_ESP32 +#endif // USE_ETHERNET