src/eric7/MicroPython/EthernetDialogs/WiznetUtilities.py

branch
mpy_network
changeset 9878
a82014a9e57b
child 9885
05cbf70e8f10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/MicroPython/EthernetDialogs/WiznetUtilities.py	Sun Mar 12 14:56:04 2023 +0100
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2023 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing WIZnet 5x00 related utility functions.
+"""
+
+
+def wiznetInit():
+    """
+    Function to get the WIZnet 5x00 initialization code.
+
+    @return string containing the code to initialize the WIZnet 5x00 ethernet interface
+    @rtype str
+    """
+    return """
+def w5x00_init():
+    global nic
+
+    try:
+        nic
+    except NameError:
+        nic = None
+
+    if nic is None:
+        import network
+        from machine import Pin, SPI
+
+        spi = SPI(0, 2_000_000, mosi=Pin(19), miso=Pin(16), sck=Pin(18))
+        nic = network.WIZNET5K(spi, Pin(17), Pin(20))
+"""

eric ide

mercurial