fix LAN8720 init

This commit is contained in:
technyon
2024-07-07 13:30:04 +02:00
parent accaa1e5c0
commit 53243fe045
2 changed files with 16 additions and 17 deletions

View File

@@ -76,15 +76,14 @@ void EthLan8720Device::initialize()
WiFi.setHostname(_hostname.c_str());
#if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0))
#if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0))
_hardwareInitialized = ETH.begin(_phy_addr, _power, _mdc, _mdio, _type, _clock_mode, _use_mac_from_efuse);
#else
#ifdef CONFIG_IDF_TARGET_ESP32
_hardwareInitialized = ETH.begin(_type, _phy_addr, _mdc, _mdio, ETH_RESET_PIN, _clock_mode);
#else
#elif CONFIG_IDF_TARGET_ESP32
_hardwareInitialized = ETH.begin(_type, _phy_addr, _mdc, _mdio, _power, _clock_mode);
#else
_hardwareInitialized = false;
#endif
#endif
#endif
ETH.setHostname(_hostname.c_str());
if(!_ipConfiguration->dhcpEnabled())
{

View File

@@ -1,17 +1,17 @@
#pragma once
#if (ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0, 0))
#ifndef CONFIG_IDF_TARGET_ESP32
typedef enum {
ETH_CLOCK_GPIO0_IN = 0,
ETH_CLOCK_GPIO16_OUT = 2,
ETH_CLOCK_GPIO17_OUT = 3
} eth_clock_mode_t;
#ifndef CONFIG_IDF_TARGET_ESP32
// typedef enum {
// ETH_CLOCK_GPIO0_IN = 0,
// ETH_CLOCK_GPIO16_OUT = 2,
// ETH_CLOCK_GPIO17_OUT = 3
// } eth_clock_mode_t;
#define ETH_PHY_TYPE ETH_PHY_MAX
#else
#define ETH_PHY_TYPE ETH_PHY_LAN8720
#endif
#define ETH_PHY_TYPE ETH_PHY_MAX
#else
#define ETH_PHY_TYPE ETH_PHY_LAN8720
#endif
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN