forked from espressif/arduino-esp32
Also support ESP_IDF_VERSION_MAJOR > 3 Fixes #6458 Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com> Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
This commit is contained in:
@ -226,12 +226,19 @@ ETHClass::ETHClass()
|
||||
ETHClass::~ETHClass()
|
||||
{}
|
||||
|
||||
bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_type_t type, eth_clock_mode_t clock_mode)
|
||||
bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_type_t type, eth_clock_mode_t clock_mode, bool use_mac_from_efuse)
|
||||
{
|
||||
#if ESP_IDF_VERSION_MAJOR > 3
|
||||
eth_clock_mode = clock_mode;
|
||||
tcpipInit();
|
||||
|
||||
if (use_mac_from_efuse)
|
||||
{
|
||||
uint8_t p[6] = { 0x00,0x00,0x00,0x00,0x00,0x00 };
|
||||
esp_efuse_mac_get_custom(p);
|
||||
esp_base_mac_addr_set(p);
|
||||
}
|
||||
|
||||
tcpip_adapter_set_default_eth_handlers();
|
||||
|
||||
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
|
||||
@ -363,6 +370,14 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
|
||||
}
|
||||
|
||||
tcpipInit();
|
||||
|
||||
if (use_mac_from_efuse)
|
||||
{
|
||||
uint8_t p[6] = { 0x00,0x00,0x00,0x00,0x00,0x00 };
|
||||
esp_efuse_mac_get_custom(p);
|
||||
esp_base_mac_addr_set(p);
|
||||
}
|
||||
|
||||
err = esp_eth_init(ð_config);
|
||||
if(!err){
|
||||
initialized = true;
|
||||
|
@ -75,7 +75,7 @@ class ETHClass {
|
||||
ETHClass();
|
||||
~ETHClass();
|
||||
|
||||
bool begin(uint8_t phy_addr=ETH_PHY_ADDR, int power=ETH_PHY_POWER, int mdc=ETH_PHY_MDC, int mdio=ETH_PHY_MDIO, eth_phy_type_t type=ETH_PHY_TYPE, eth_clock_mode_t clk_mode=ETH_CLK_MODE);
|
||||
bool begin(uint8_t phy_addr=ETH_PHY_ADDR, int power=ETH_PHY_POWER, int mdc=ETH_PHY_MDC, int mdio=ETH_PHY_MDIO, eth_phy_type_t type=ETH_PHY_TYPE, eth_clock_mode_t clk_mode=ETH_CLK_MODE, bool use_mac_from_efuse=false);
|
||||
|
||||
bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = (uint32_t)0x00000000, IPAddress dns2 = (uint32_t)0x00000000);
|
||||
|
||||
|
Reference in New Issue
Block a user