Skip to content

Commit efb4bd3

Browse files
robert-hhdpgeorge
authored andcommitted
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.
1 parent fc745d8 commit efb4bd3

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Diff for: ports/esp32/modnetwork.c

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
261261
#endif
262262

263263
#if (ESP_IDF_VERSION_MAJOR == 4) && (ESP_IDF_VERSION_MINOR >= 1) && (CONFIG_IDF_TARGET_ESP32)
264+
{ MP_ROM_QSTR(MP_QSTR_PHY_LAN8710), MP_ROM_INT(PHY_LAN8710) },
264265
{ MP_ROM_QSTR(MP_QSTR_PHY_LAN8720), MP_ROM_INT(PHY_LAN8720) },
265266
{ MP_ROM_QSTR(MP_QSTR_PHY_IP101), MP_ROM_INT(PHY_IP101) },
266267
{ MP_ROM_QSTR(MP_QSTR_PHY_RTL8201), MP_ROM_INT(PHY_RTL8201) },

Diff for: ports/esp32/modnetwork.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#include "esp_event.h"
3030

31-
enum { PHY_LAN8720, PHY_IP101, PHY_RTL8201, PHY_DP83848, PHY_KSZ8041 };
31+
enum { PHY_LAN8710, PHY_LAN8720, PHY_IP101, PHY_RTL8201, PHY_DP83848, PHY_KSZ8041 };
3232
enum { ETH_INITIALIZED, ETH_STARTED, ETH_STOPPED, ETH_CONNECTED, ETH_DISCONNECTED, ETH_GOT_IP };
3333

3434
// Cases similar to ESP8266 user_interface.h

Diff for: ports/esp32/network_lan.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -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
125125
}
126126
self->phy_addr = args[ARG_phy_addr].u_int;
127127

128-
if (args[ARG_phy_type].u_int != PHY_LAN8720 &&
128+
if (args[ARG_phy_type].u_int != PHY_LAN8710 &&
129+
args[ARG_phy_type].u_int != PHY_LAN8720 &&
129130
args[ARG_phy_type].u_int != PHY_IP101 &&
130131
args[ARG_phy_type].u_int != PHY_RTL8201 &&
131132
#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
146147
self->phy = NULL;
147148

148149
switch (args[ARG_phy_type].u_int) {
150+
case PHY_LAN8710:
149151
case PHY_LAN8720:
150152
self->phy = esp_eth_phy_new_lan8720(&phy_config);
151153
break;

0 commit comments

Comments
 (0)