esp32/network_lan: Add support for LAN8710 PHY.
LAN8710 uses the same drivers as LAN8720, so this commit just adds the names. Alternatively, both could be summarised under LAN87xx, like the esp-idf does.
This commit is contained in:
parent
fc745d85fe
commit
efb4bd3555
@ -261,6 +261,7 @@ STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (ESP_IDF_VERSION_MAJOR == 4) && (ESP_IDF_VERSION_MINOR >= 1) && (CONFIG_IDF_TARGET_ESP32)
|
#if (ESP_IDF_VERSION_MAJOR == 4) && (ESP_IDF_VERSION_MINOR >= 1) && (CONFIG_IDF_TARGET_ESP32)
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_PHY_LAN8710), MP_ROM_INT(PHY_LAN8710) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_PHY_LAN8720), MP_ROM_INT(PHY_LAN8720) },
|
{ MP_ROM_QSTR(MP_QSTR_PHY_LAN8720), MP_ROM_INT(PHY_LAN8720) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_PHY_IP101), MP_ROM_INT(PHY_IP101) },
|
{ MP_ROM_QSTR(MP_QSTR_PHY_IP101), MP_ROM_INT(PHY_IP101) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_PHY_RTL8201), MP_ROM_INT(PHY_RTL8201) },
|
{ MP_ROM_QSTR(MP_QSTR_PHY_RTL8201), MP_ROM_INT(PHY_RTL8201) },
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
|
|
||||||
enum { PHY_LAN8720, PHY_IP101, PHY_RTL8201, PHY_DP83848, PHY_KSZ8041 };
|
enum { PHY_LAN8710, PHY_LAN8720, PHY_IP101, PHY_RTL8201, PHY_DP83848, PHY_KSZ8041 };
|
||||||
enum { ETH_INITIALIZED, ETH_STARTED, ETH_STOPPED, ETH_CONNECTED, ETH_DISCONNECTED, ETH_GOT_IP };
|
enum { ETH_INITIALIZED, ETH_STARTED, ETH_STOPPED, ETH_CONNECTED, ETH_DISCONNECTED, ETH_GOT_IP };
|
||||||
|
|
||||||
// Cases similar to ESP8266 user_interface.h
|
// Cases similar to ESP8266 user_interface.h
|
||||||
|
@ -125,7 +125,8 @@ STATIC mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
|
|||||||
}
|
}
|
||||||
self->phy_addr = args[ARG_phy_addr].u_int;
|
self->phy_addr = args[ARG_phy_addr].u_int;
|
||||||
|
|
||||||
if (args[ARG_phy_type].u_int != PHY_LAN8720 &&
|
if (args[ARG_phy_type].u_int != PHY_LAN8710 &&
|
||||||
|
args[ARG_phy_type].u_int != PHY_LAN8720 &&
|
||||||
args[ARG_phy_type].u_int != PHY_IP101 &&
|
args[ARG_phy_type].u_int != PHY_IP101 &&
|
||||||
args[ARG_phy_type].u_int != PHY_RTL8201 &&
|
args[ARG_phy_type].u_int != PHY_RTL8201 &&
|
||||||
#if ESP_IDF_VERSION_MINOR >= 3 // KSZ8041 is new in ESP-IDF v4.3
|
#if ESP_IDF_VERSION_MINOR >= 3 // KSZ8041 is new in ESP-IDF v4.3
|
||||||
@ -146,6 +147,7 @@ STATIC mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
|
|||||||
self->phy = NULL;
|
self->phy = NULL;
|
||||||
|
|
||||||
switch (args[ARG_phy_type].u_int) {
|
switch (args[ARG_phy_type].u_int) {
|
||||||
|
case PHY_LAN8710:
|
||||||
case PHY_LAN8720:
|
case PHY_LAN8720:
|
||||||
self->phy = esp_eth_phy_new_lan8720(&phy_config);
|
self->phy = esp_eth_phy_new_lan8720(&phy_config);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user