MicroPython 官方给出的是必须是 IDF4.1 以上的版本才可以,但我这个版本应该是比较新的了,依然找不到这个函数。
因为后面还有其他代码,所有不可能用 esp_eth_mac_new_w5500 替代,请问应该如何解决?
Code: Select all
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
mac_config.smi_mdc_gpio_num = self->mdc_pin;
mac_config.smi_mdio_gpio_num = self->mdio_pin;
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.phy_addr = self->phy_addr;
phy_config.reset_gpio_num = self->phy_power_pin;
self->phy = NULL;
switch (args[ARG_phy_type].u_int) {
case PHY_LAN8720:
self->phy = esp_eth_phy_new_lan8720(&phy_config);
break;
case PHY_IP101:
self->phy = esp_eth_phy_new_ip101(&phy_config);
break;
case PHY_RTL8201:
self->phy = esp_eth_phy_new_rtl8201(&phy_config);
break;
case PHY_DP83848:
self->phy = esp_eth_phy_new_dp83848(&phy_config);
break;
case PHY_W5500:
self->phy = esp_eth_phy_new_w5500(&phy_config);
break;
case PHY_DM9051:
self->phy = esp_eth_phy_new_dm9051(&phy_config);
break;
case PHY_KSZ8851SNL:
self->phy = esp_eth_phy_new_ksz8851snl(&phy_config);
break;
case PHY_KSZ8041:
#if ESP_IDF_VERSION_MINOR >= 3 // KSZ8041 is new in ESP-IDF v4.3
self->phy = esp_eth_phy_new_ksz8041(&phy_config);
break;
#endif
default:
mp_raise_ValueError(MP_ERROR_TEXT("unknown phy"));
}