diff options
| author | Daniel Campora | 2015-09-27 13:45:48 +0200 |
|---|---|---|
| committer | Daniel Campora | 2015-09-27 16:50:27 +0200 |
| commit | c92e6a45ebba4d41c2d0d891e07f94a81d2f601f (patch) | |
| tree | e861f7bfb70147d7a648cefc4c47c4b8e682f52d /cc3200/tools | |
| parent | 0a7e4fa5cee7dcb6ce060bef37d4eae5e6f06503 (diff) | |
cc3200: Rename pyb module to machine.
Diffstat (limited to 'cc3200/tools')
| -rw-r--r-- | cc3200/tools/smoke.py | 30 | ||||
| -rw-r--r-- | cc3200/tools/update-wipy.py | 6 |
2 files changed, 19 insertions, 17 deletions
diff --git a/cc3200/tools/smoke.py b/cc3200/tools/smoke.py index 45187b697..20a837787 100644 --- a/cc3200/tools/smoke.py +++ b/cc3200/tools/smoke.py @@ -1,4 +1,6 @@ -import pyb +from machine import Pin +from machine import RTC +import time import os """ @@ -13,31 +15,31 @@ test_bytes = os.urandom(1024) def test_pin_read (pull): # enable the pull resistor on all pins, then read the value for p in pin_map: - pin = pyb.Pin('GP' + str(p), mode=pyb.Pin.IN, pull=pull) + pin = Pin('GP' + str(p), mode=Pin.IN, pull=pull) # read the pin value print(pin()) def test_pin_shorts (pull): - if pull == pyb.Pin.PULL_UP: - pull_inverted = pyb.Pin.PULL_DOWN + if pull == Pin.PULL_UP: + pull_inverted = Pin.PULL_DOWN else: - pull_inverted = pyb.Pin.PULL_UP + pull_inverted = Pin.PULL_UP # enable all pulls of the specified type for p in pin_map: - pin = pyb.Pin('GP' + str(p), mode=pyb.Pin.IN, pull=pull_inverted) + pin = Pin('GP' + str(p), mode=Pin.IN, pull=pull_inverted) # then change the pull one pin at a time and read its value i = 0 while i < len(pin_map): - pin = pyb.Pin('GP' + str(pin_map[i]), mode=pyb.Pin.IN, pull=pull) - pyb.Pin('GP' + str(pin_map[i - 1]), mode=pyb.Pin.IN, pull=pull_inverted) + pin = Pin('GP' + str(pin_map[i]), mode=Pin.IN, pull=pull) + Pin('GP' + str(pin_map[i - 1]), mode=Pin.IN, pull=pull_inverted) i += 1 # read the pin value print(pin()) -test_pin_read(pyb.Pin.PULL_UP) -test_pin_read(pyb.Pin.PULL_DOWN) -test_pin_shorts(pyb.Pin.PULL_UP) -test_pin_shorts(pyb.Pin.PULL_DOWN) +test_pin_read(Pin.PULL_UP) +test_pin_read(Pin.PULL_DOWN) +test_pin_shorts(Pin.PULL_UP) +test_pin_shorts(Pin.PULL_DOWN) # create a test directory os.mkdir('/flash/test') @@ -62,12 +64,12 @@ print('test' not in ls) print(ls) # test the real time clock -rtc = pyb.RTC() +rtc = RTC() while rtc.now()[6] > 800: pass time1 = rtc.now() -pyb.delay(1000) +time.sleep_ms(1000) time2 = rtc.now() print(time2[5] - time1[5] == 1) print(time2[6] - time1[6] < 5000) # microseconds diff --git a/cc3200/tools/update-wipy.py b/cc3200/tools/update-wipy.py index 857a3d650..2d5fe57c2 100644 --- a/cc3200/tools/update-wipy.py +++ b/cc3200/tools/update-wipy.py @@ -90,9 +90,9 @@ def reset_board(args): time.sleep(1) tn.write(b'\r\x02') # ctrl-B: enter friendly REPL if b'Type "help()" for more information.' in tn.read_until(b'Type "help()" for more information.', timeout=5): - tn.write(b"import pyb\r\n") - tn.write(b"pyb.reset()\r\n") - time.sleep(1) + tn.write(b"import machine\r\n") + tn.write(b"machine.reset()\r\n") + time.sleep(2) print("Reset performed") success = True else: |
