Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc367544

Browse files
committed
esp32/network_lan: Add PHY_GENERIC device type.
Support the new PHY_GENERIC device type, added in ESP-IDF v5.4.0 [1].This PHY driver was added to ESP-IDF to support "generic"/oddball PHYLAN chips like the JL1101, which offer no features beyond the bare802.3 PHY standard and don't actually need a chip-specific driver (seediscussion at [2]).[1]espressif/esp-idf@0738314[2]espressif/esp-eth-drivers#28Signed-off-by: Elvis Pfutzenreuter <epxx@epxx.co>
1 parent00a0cd7 commitc367544

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

‎docs/esp32/quickref.rst

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ Required keyword arguments for the constructor:
148148
- ``mdc`` and ``mdio`` -:class:`machine.Pin` objects (or integers) specifying
149149
the MDC and MDIO pins.
150150
- ``phy_type`` - Select the PHY device type. Supported devices are
151+
``PHY_GENERIC``,
151152
``PHY_LAN8710``, ``PHY_LAN8720``, ``PHY_IP101``, ``PHY_RTL8201``,
152153
``PHY_DP83848``, ``PHY_KSZ8041`` and ``PHY_KSZ8081``. These values are all
153154
constants defined in the ``network`` module.

‎ports/esp32/modnetwork.h

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

2929
#include"esp_netif.h"
3030

31-
enum {PHY_LAN8710,PHY_LAN8720,PHY_IP101,PHY_RTL8201,PHY_DP83848,PHY_KSZ8041,PHY_KSZ8081,PHY_KSZ8851SNL=100,PHY_DM9051,PHY_W5500 };
31+
enum {PHY_LAN8710,PHY_LAN8720,PHY_IP101,PHY_RTL8201,PHY_DP83848,PHY_KSZ8041,PHY_KSZ8081,PHY_GENERIC,PHY_KSZ8851SNL=100,PHY_DM9051,PHY_W5500 };
3232
#defineIS_SPI_PHY(NUM) (NUM >= 100)
3333
enum {ETH_INITIALIZED,ETH_STARTED,ETH_STOPPED,ETH_CONNECTED,ETH_DISCONNECTED,ETH_GOT_IP };
3434

‎ports/esp32/modnetwork_globals.h

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#ifMICROPY_PY_NETWORK_LAN
4343
{MP_ROM_QSTR(MP_QSTR_PHY_LAN8710),MP_ROM_INT(PHY_LAN8710) },
4444
{MP_ROM_QSTR(MP_QSTR_PHY_LAN8720),MP_ROM_INT(PHY_LAN8720) },
45+
{MP_ROM_QSTR(MP_QSTR_PHY_GENERIC),MP_ROM_INT(PHY_GENERIC) },
4546
{MP_ROM_QSTR(MP_QSTR_PHY_IP101),MP_ROM_INT(PHY_IP101) },
4647
{MP_ROM_QSTR(MP_QSTR_PHY_RTL8201),MP_ROM_INT(PHY_RTL8201) },
4748
{MP_ROM_QSTR(MP_QSTR_PHY_DP83848),MP_ROM_INT(PHY_DP83848) },

‎ports/esp32/network_lan.c

+8
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ static mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
152152

153153
if (args[ARG_phy_type].u_int!=PHY_LAN8710&&
154154
args[ARG_phy_type].u_int!=PHY_LAN8720&&
155+
args[ARG_phy_type].u_int!=PHY_GENERIC&&
155156
args[ARG_phy_type].u_int!=PHY_IP101&&
156157
args[ARG_phy_type].u_int!=PHY_RTL8201&&
157158
args[ARG_phy_type].u_int!=PHY_KSZ8041&&
@@ -221,6 +222,13 @@ static mp_obj_t get_lan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ar
221222
casePHY_IP101:
222223
self->phy=esp_eth_phy_new_ip101(&phy_config);
223224
break;
225+
casePHY_GENERIC:
226+
#ifESP_IDF_VERSION >=ESP_IDF_VERSION_VAL(5,4,0)
227+
self->phy=esp_eth_phy_new_generic(&phy_config);
228+
#else
229+
mp_raise_msg(&mp_type_OSError,MP_ERROR_TEXT("PHY_GENERIC not supported in ESP-IDF < 5.4"));
230+
#endif
231+
break;
224232
casePHY_RTL8201:
225233
self->phy=esp_eth_phy_new_rtl8201(&phy_config);
226234
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp