Skip to content

Commit befb98a

Browse files
TinyuZhaolbuque
authored andcommitted
libs/driver: Add IP101GRI driver.
Signed-off-by: tinyu <tinyu.zhao@gmail.com>
1 parent a0250ed commit befb98a

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

m5stack/libs/driver/ip101gri.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
import network
6+
import machine
7+
import builtins
8+
9+
10+
class IP101GRI:
11+
def __new__(cls, mdc_pin, mdio_pin, power_pin):
12+
nic = network.LAN(
13+
0,
14+
phy_addr=1,
15+
phy_type=network.PHY_IP101,
16+
mdc=machine.Pin(mdc_pin),
17+
mdio=machine.Pin(mdio_pin),
18+
power=machine.Pin(power_pin),
19+
)
20+
mac = builtins.int.from_bytes(machine.unique_id(), "big")
21+
nic.config(mac=mac.to_bytes(6, "big"))
22+
nic.active(True)
23+
return nic

m5stack/libs/driver/manifest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"drf1609h.py",
7878
"haptic.py",
7979
"ina226.py",
80+
"ip101gri.py",
8081
"max3421e.py",
8182
"mcp4725.py",
8283
"mlx90614.py",

0 commit comments

Comments
 (0)