src/eric7/MicroPython/EthernetDialogs/WiznetUtilities.py

branch
mpy_network
changeset 9878
a82014a9e57b
child 9885
05cbf70e8f10
equal deleted inserted replaced
9877:dad1f6d37366 9878:a82014a9e57b
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2023 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing WIZnet 5x00 related utility functions.
8 """
9
10
11 def wiznetInit():
12 """
13 Function to get the WIZnet 5x00 initialization code.
14
15 @return string containing the code to initialize the WIZnet 5x00 ethernet interface
16 @rtype str
17 """
18 return """
19 def w5x00_init():
20 global nic
21
22 try:
23 nic
24 except NameError:
25 nic = None
26
27 if nic is None:
28 import network
29 from machine import Pin, SPI
30
31 spi = SPI(0, 2_000_000, mosi=Pin(19), miso=Pin(16), sck=Pin(18))
32 nic = network.WIZNET5K(spi, Pin(17), Pin(20))
33 """

eric ide

mercurial