src/eric7/MicroPython/EthernetDialogs/WiznetUtilities.py

Sun, 12 Mar 2023 14:56:04 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 12 Mar 2023 14:56:04 +0100
branch
mpy_network
changeset 9878
a82014a9e57b
child 9885
05cbf70e8f10
permissions
-rw-r--r--

MicroPython
- Added support for Ethernet enabled boards.

# -*- 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