src/eric7/MicroPython/Devices/MCUScripts/picoWiznetConnect.py

branch
eric7
changeset 10153
ffe7432f716b
parent 9890
66a6d3f131cc
equal deleted inserted replaced
10152:33e7b9d3f91c 10153:ffe7432f716b
6 import time 6 import time
7 from machine import Pin, SPI 7 from machine import Pin, SPI
8 8
9 try: 9 try:
10 ifconfig = wiznet_config.ifconfig 10 ifconfig = wiznet_config.ifconfig
11 hostname = wiznet_config.hostname
11 except AttributeError: 12 except AttributeError:
12 print("The network configuration in 'wiznet_config.py' is invalid.") 13 print("The network configuration in 'wiznet_config.py' is invalid.")
13 return None 14 return None
15
16 if hostname:
17 try:
18 network.hostname(hostname)
19 except AttributeError:
20 pass
14 21
15 spi = SPI(0, 2_000_000, mosi=Pin(19), miso=Pin(16), sck=Pin(18)) 22 spi = SPI(0, 2_000_000, mosi=Pin(19), miso=Pin(16), sck=Pin(18))
16 nic = network.WIZNET5K(spi, Pin(17), Pin(20)) 23 nic = network.WIZNET5K(spi, Pin(17), Pin(20))
17 24
18 nic.active(False) 25 nic.active(False)

eric ide

mercurial