all: Replace all uses of umodule in Python code.
Applies to drivers/examples/extmod/port-modules/tools. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
@@ -40,13 +40,13 @@ application of this idea would look like:
|
||||
`app.py`:
|
||||
|
||||
from hwconfig import *
|
||||
import utime
|
||||
import time
|
||||
|
||||
while True:
|
||||
LED.value(1)
|
||||
utime.sleep_ms(500)
|
||||
time.sleep_ms(500)
|
||||
LED.value(0)
|
||||
utime.sleep_ms(500)
|
||||
time.sleep_ms(500)
|
||||
|
||||
|
||||
To deploy this application to a particular board, a user will need:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import utime
|
||||
import time
|
||||
from hwconfig import LED, BUTTON
|
||||
|
||||
# Light LED when (and while) a BUTTON is pressed
|
||||
@@ -6,4 +6,4 @@ from hwconfig import LED, BUTTON
|
||||
while 1:
|
||||
LED.value(BUTTON.value())
|
||||
# Don't burn CPU
|
||||
utime.sleep_ms(10)
|
||||
time.sleep_ms(10)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import utime
|
||||
import time
|
||||
import machine
|
||||
from hwconfig import LED, BUTTON
|
||||
|
||||
@@ -18,4 +18,4 @@ while 1:
|
||||
print("Well, you're *really* slow")
|
||||
else:
|
||||
print("You are as slow as %d microseconds!" % delay)
|
||||
utime.sleep_ms(10)
|
||||
time.sleep_ms(10)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import utime
|
||||
import time
|
||||
from hwconfig import LED
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ def pwm_cycle(led, duty, cycles):
|
||||
for i in range(cycles):
|
||||
if duty:
|
||||
led.on()
|
||||
utime.sleep_ms(duty)
|
||||
time.sleep_ms(duty)
|
||||
if duty_off:
|
||||
led.off()
|
||||
utime.sleep_ms(duty_off)
|
||||
time.sleep_ms(duty_off)
|
||||
|
||||
|
||||
# At the duty setting of 1, an LED is still pretty bright, then
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
try:
|
||||
import usocket as socket
|
||||
except:
|
||||
import socket
|
||||
import socket
|
||||
|
||||
|
||||
def main(use_stream=False):
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
try:
|
||||
import usocket as _socket
|
||||
except:
|
||||
import _socket
|
||||
try:
|
||||
import ussl as ssl
|
||||
except:
|
||||
import ssl
|
||||
import socket
|
||||
import ssl
|
||||
|
||||
|
||||
def main(use_stream=True):
|
||||
s = _socket.socket()
|
||||
s = socket.socket()
|
||||
|
||||
ai = _socket.getaddrinfo("google.com", 443)
|
||||
ai = socket.getaddrinfo("google.com", 443)
|
||||
print("Address infos:", ai)
|
||||
addr = ai[0][-1]
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
try:
|
||||
import usocket as socket
|
||||
except:
|
||||
import socket
|
||||
import socket
|
||||
|
||||
|
||||
CONTENT = b"""\
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
# Do not use this code in real projects! Read
|
||||
# http_server_simplistic_commented.py for details.
|
||||
try:
|
||||
import usocket as socket
|
||||
except:
|
||||
import socket
|
||||
import socket
|
||||
|
||||
|
||||
CONTENT = b"""\
|
||||
|
||||
@@ -8,10 +8,7 @@
|
||||
# details, and use this code only for quick hacks, preferring
|
||||
# http_server.py for "real thing".
|
||||
#
|
||||
try:
|
||||
import usocket as socket
|
||||
except:
|
||||
import socket
|
||||
import socket
|
||||
|
||||
|
||||
CONTENT = b"""\
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import ubinascii as binascii
|
||||
|
||||
try:
|
||||
import usocket as socket
|
||||
except:
|
||||
import socket
|
||||
import ussl as ssl
|
||||
import binascii
|
||||
import socket
|
||||
import ssl
|
||||
|
||||
|
||||
# This self-signed key/cert pair is randomly generated and to be used for
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
# It is expected to print 0xaa55, which is a signature at the start of
|
||||
# Video BIOS.
|
||||
|
||||
import umachine as machine
|
||||
import machine
|
||||
|
||||
print(hex(machine.mem16[0xC0000]))
|
||||
|
||||
Reference in New Issue
Block a user