[ethernet] SPI devices require esp-idf

The W5500 driver will only be built with esp-idf.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
This commit is contained in:
Bjørn Mork 2024-08-07 13:53:57 +02:00
parent c60e760ab7
commit baea9a9a96
No known key found for this signature in database
GPG key ID: 22044ECBBFA4615D
4 changed files with 18 additions and 19 deletions

View file

@ -233,6 +233,8 @@ CONFIG_SCHEMA = cv.All(
def _final_validate(config): def _final_validate(config):
if config[CONF_TYPE] not in SPI_ETHERNET_TYPES: if config[CONF_TYPE] not in SPI_ETHERNET_TYPES:
return return
if not CORE.using_esp_idf:
raise cv.Invalid("SPI ethernet requires ESP-IDF")
if spi_configs := fv.full_config.get().get(CONF_SPI): if spi_configs := fv.full_config.get().get(CONF_SPI):
variant = get_esp32_variant() variant = get_esp32_variant()
if variant in (VARIANT_ESP32C3, VARIANT_ESP32S2, VARIANT_ESP32S3): if variant in (VARIANT_ESP32C3, VARIANT_ESP32S2, VARIANT_ESP32S3):
@ -293,9 +295,8 @@ async def to_code(config):
cg.add(var.set_clock_speed(config[CONF_CLOCK_SPEED])) cg.add(var.set_clock_speed(config[CONF_CLOCK_SPEED]))
cg.add_define("USE_ETHERNET_SPI") cg.add_define("USE_ETHERNET_SPI")
if CORE.using_esp_idf: add_idf_sdkconfig_option("CONFIG_ETH_USE_SPI_ETHERNET", True)
add_idf_sdkconfig_option("CONFIG_ETH_USE_SPI_ETHERNET", True) add_idf_sdkconfig_option("CONFIG_ETH_SPI_ETHERNET_W5500", True)
add_idf_sdkconfig_option("CONFIG_ETH_SPI_ETHERNET_W5500", True)
elif config[CONF_TYPE] == "OPENETH": elif config[CONF_TYPE] == "OPENETH":
cg.add_define("USE_ETHERNET_OPENETH") cg.add_define("USE_ETHERNET_OPENETH")
add_idf_sdkconfig_option("CONFIG_ETH_USE_OPENETH", True) add_idf_sdkconfig_option("CONFIG_ETH_USE_OPENETH", True)

View file

@ -1,14 +0,0 @@
ethernet:
type: W5500
clk_pin: 19
mosi_pin: 21
miso_pin: 23
cs_pin: 18
interrupt_pin: 36
reset_pin: 22
clock_speed: 10Mhz
manual_ip:
static_ip: 192.168.178.56
gateway: 192.168.178.1
subnet: 255.255.255.0
domain: .local

View file

@ -1 +0,0 @@
<<: !include common-w5500.yaml

View file

@ -1 +1,14 @@
<<: !include common-w5500.yaml ethernet:
type: W5500
clk_pin: 19
mosi_pin: 21
miso_pin: 23
cs_pin: 18
interrupt_pin: 36
reset_pin: 22
clock_speed: 10Mhz
manual_ip:
static_ip: 192.168.178.56
gateway: 192.168.178.1
subnet: 255.255.255.0
domain: .local