summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-09-27 13:45:48 +0200
committerDaniel Campora <daniel@wipy.io>2015-09-27 16:50:27 +0200
commitc92e6a45ebba4d41c2d0d891e07f94a81d2f601f (patch)
treee861f7bfb70147d7a648cefc4c47c4b8e682f52d /tests
parent0a7e4fa5cee7dcb6ce060bef37d4eae5e6f06503 (diff)
downloadmicropython-c92e6a45ebba4d41c2d0d891e07f94a81d2f601f.tar.gz
micropython-c92e6a45ebba4d41c2d0d891e07f94a81d2f601f.zip
cc3200: Rename pyb module to machine.
Diffstat (limited to 'tests')
-rw-r--r--tests/wipy/adc.py8
-rw-r--r--tests/wipy/i2c.py8
-rw-r--r--tests/wipy/os.py9
-rw-r--r--tests/wipy/pin.py8
-rw-r--r--tests/wipy/pin_irq.py20
-rw-r--r--tests/wipy/reset/reset.py7
-rw-r--r--tests/wipy/rtc.py6
-rw-r--r--tests/wipy/rtc_irq.py18
-rw-r--r--tests/wipy/sd.py8
-rw-r--r--tests/wipy/spi.py8
-rw-r--r--tests/wipy/uart.py10
-rw-r--r--tests/wipy/uart_irq.py8
-rw-r--r--tests/wipy/wdt.py2
-rw-r--r--tests/wipy/wlan/wlan.py5
14 files changed, 64 insertions, 61 deletions
diff --git a/tests/wipy/adc.py b/tests/wipy/adc.py
index 67c83bfb5c..6fd4373dbd 100644
--- a/tests/wipy/adc.py
+++ b/tests/wipy/adc.py
@@ -2,14 +2,14 @@
ADC test for the CC3200 based boards.
'''
-from pyb import ADC
+from machine import ADC
import os
-machine = os.uname().machine
-if 'LaunchPad' in machine:
+mch = os.uname().machine
+if 'LaunchPad' in mch:
adc_pin = 'GP5'
adc_channel = 3
-elif 'WiPy' in machine:
+elif 'WiPy' in mch:
adc_pin = 'GP3'
adc_channel = 1
else:
diff --git a/tests/wipy/i2c.py b/tests/wipy/i2c.py
index b5f2a610d7..6931554191 100644
--- a/tests/wipy/i2c.py
+++ b/tests/wipy/i2c.py
@@ -3,14 +3,14 @@ I2C test for the CC3200 based boards.
A MPU-9150 sensor must be connected to the I2C bus.
'''
-from pyb import I2C
+from machine import I2C
import os
import time
-machine = os.uname().machine
-if 'LaunchPad' in machine:
+mch = os.uname().machine
+if 'LaunchPad' in mch:
i2c_pins = ('GP11', 'GP10')
-elif 'WiPy' in machine:
+elif 'WiPy' in mch:
i2c_pins = ('GP15', 'GP10')
else:
raise Exception('Board not supported!')
diff --git a/tests/wipy/os.py b/tests/wipy/os.py
index 796d4699ef..cacd10958a 100644
--- a/tests/wipy/os.py
+++ b/tests/wipy/os.py
@@ -2,14 +2,13 @@
os module test for the CC3200 based boards
'''
-from pyb import SD
-import pyb
+from machine import SD
import os
-machine = os.uname().machine
-if 'LaunchPad' in machine:
+mch = os.uname().machine
+if 'LaunchPad' in mch:
sd_pins = ('GP16', 'GP17', 'GP15')
-elif 'WiPy' in machine:
+elif 'WiPy' in mch:
sd_pins = ('GP10', 'GP11', 'GP15')
else:
raise Exception('Board not supported!')
diff --git a/tests/wipy/pin.py b/tests/wipy/pin.py
index a768da0975..9f2eadb963 100644
--- a/tests/wipy/pin.py
+++ b/tests/wipy/pin.py
@@ -1,14 +1,14 @@
""" This test need a set of pins which can be set as inputs and have no external
pull up or pull down connected.
"""
-from pyb import Pin
+from machine import Pin
import os
-machine = os.uname().machine
-if 'LaunchPad' in machine:
+mch = os.uname().machine
+if 'LaunchPad' in mch:
pin_map = ['GP24', 'GP12', 'GP14', 'GP15', 'GP16', 'GP17', 'GP28', 'GP8', 'GP6', 'GP30', 'GP31', 'GP3', 'GP0', 'GP4', 'GP5']
max_af_idx = 15
-elif 'WiPy' in machine:
+elif 'WiPy' in mch:
pin_map = ['GP23', 'GP24', 'GP12', 'GP13', 'GP14', 'GP9', 'GP17', 'GP28', 'GP22', 'GP8', 'GP30', 'GP31', 'GP0', 'GP4', 'GP5']
max_af_idx = 15
else:
diff --git a/tests/wipy/pin_irq.py b/tests/wipy/pin_irq.py
index 75a7f090d8..875f1f9397 100644
--- a/tests/wipy/pin_irq.py
+++ b/tests/wipy/pin_irq.py
@@ -2,15 +2,15 @@
Pin IRQ test for the CC3200 based boards.
'''
-from pyb import Pin
-from pyb import Sleep
+from machine import Pin
+import machine
import os
import time
-machine = os.uname().machine
-if 'LaunchPad' in machine:
+mch = os.uname().machine
+if 'LaunchPad' in mch:
pins = ['GP16', 'GP13']
-elif 'WiPy' in machine:
+elif 'WiPy' in mch:
pins = ['GP16', 'GP13']
else:
raise Exception('Board not supported!')
@@ -78,16 +78,16 @@ print(pin_irq_count_total == 0)
# test waking up from suspended mode on low level
pin0(0)
t0 = time.ticks_ms()
-pin1_irq.init(trigger=Pin.IRQ_LOW_LEVEL, wake=Sleep.SUSPENDED)
-Sleep.suspend()
+pin1_irq.init(trigger=Pin.IRQ_LOW_LEVEL, wake=machine.SLEEP)
+machine.sleep()
print(time.ticks_ms() - t0 < 10)
print('Awake')
# test waking up from suspended mode on high level
pin0(1)
t0 = time.ticks_ms()
-pin1_irq.init(trigger=Pin.IRQ_HIGH_LEVEL, wake=Sleep.SUSPENDED)
-Sleep.suspend()
+pin1_irq.init(trigger=Pin.IRQ_HIGH_LEVEL, wake=machine.SLEEP)
+machine.sleep()
print(time.ticks_ms() - t0 < 10)
print('Awake')
@@ -108,7 +108,7 @@ except:
print('Exception')
try:
- pin0_irq = pin0.irq(trigger=Pin.IRQ_RISING, wake=Sleep.SUSPENDED) # GP16 can't wake up from DEEPSLEEP
+ pin0_irq = pin0.irq(trigger=Pin.IRQ_RISING, wake=machine.SLEEP) # GP16 can't wake up from DEEPSLEEP
except:
print('Exception')
diff --git a/tests/wipy/reset/reset.py b/tests/wipy/reset/reset.py
index c1990a4af3..35a970c673 100644
--- a/tests/wipy/reset/reset.py
+++ b/tests/wipy/reset/reset.py
@@ -4,8 +4,13 @@ This is needed to force the board to reboot
with the default WLAN AP settings
'''
-from pyb import WDT
+from machine import WDT
import time
+import os
+
+mch = os.uname().machine
+if not 'LaunchPad' in mch and not 'WiPy' in mch:
+ raise Exception('Board not supported!')
wdt = WDT(timeout=1000)
print(wdt)
diff --git a/tests/wipy/rtc.py b/tests/wipy/rtc.py
index ca6a34267f..2737ebe73a 100644
--- a/tests/wipy/rtc.py
+++ b/tests/wipy/rtc.py
@@ -2,12 +2,12 @@
RTC test for the CC3200 based boards.
'''
-from pyb import RTC
+from machine import RTC
import os
import time
-machine = os.uname().machine
-if not 'LaunchPad' in machine and not 'WiPy' in machine:
+mch = os.uname().machine
+if not 'LaunchPad' in mch and not 'WiPy' in mch:
raise Exception('Board not supported!')
rtc = RTC()
diff --git a/tests/wipy/rtc_irq.py b/tests/wipy/rtc_irq.py
index 2d4eaacabf..ec3baa5524 100644
--- a/tests/wipy/rtc_irq.py
+++ b/tests/wipy/rtc_irq.py
@@ -2,13 +2,13 @@
RTC IRQ test for the CC3200 based boards.
'''
-from pyb import RTC
-from pyb import Sleep
+from machine import RTC
+import machine
import os
import time
-machine = os.uname().machine
-if not 'LaunchPad' in machine and not 'WiPy' in machine:
+mch = os.uname().machine
+if not 'LaunchPad' in mch and not 'WiPy' in mch:
raise Exception('Board not supported!')
def rtc_ticks_ms(rtc):
@@ -47,9 +47,9 @@ print(rtc_irq_count == 10)
rtc.alarm_cancel()
rtc_irq_count = 0
rtc.alarm(time=50, repeat=True)
-rtc_irq.init(trigger=RTC.ALARM0, handler=alarm_handler, wake=Sleep.SUSPENDED | Sleep.ACTIVE)
+rtc_irq.init(trigger=RTC.ALARM0, handler=alarm_handler, wake=machine.SLEEP | machine.IDLE)
while rtc_irq_count < 3:
- Sleep.suspend()
+ machine.sleep()
print(rtc_irq_count == 3)
# no repetition
@@ -62,7 +62,7 @@ print(rtc_irq_count == 1)
rtc.alarm_cancel()
t0 = rtc_ticks_ms(rtc)
rtc.alarm(time=500, repeat=False)
-Sleep.suspend()
+machine.sleep()
t1 = rtc_ticks_ms(rtc)
print(abs(t1 - t0 - 500) < 20)
@@ -71,9 +71,9 @@ rtc.alarm_cancel()
rtc_irq_count = 0
rtc.alarm(time=500, repeat=True)
t0 = rtc_ticks_ms(rtc)
-rtc_irq = rtc.irq(trigger=RTC.ALARM0, handler=alarm_handler, wake=Sleep.SUSPENDED)
+rtc_irq = rtc.irq(trigger=RTC.ALARM0, handler=alarm_handler, wake=machine.SLEEP)
while rtc_irq_count < 3:
- Sleep.suspend()
+ machine.sleep()
t1 = rtc_ticks_ms(rtc)
print(abs(t1 - t0 - (500 * rtc_irq_count)) < 25)
diff --git a/tests/wipy/sd.py b/tests/wipy/sd.py
index 2b66af78bb..92746e01ed 100644
--- a/tests/wipy/sd.py
+++ b/tests/wipy/sd.py
@@ -2,13 +2,13 @@
SD card test for the CC3200 based boards.
'''
-from pyb import SD
+from machine import SD
import os
-machine = os.uname().machine
-if 'LaunchPad' in machine:
+mch = os.uname().machine
+if 'LaunchPad' in mch:
sd_pins = ('GP16', 'GP17', 'GP15')
-elif 'WiPy' in machine:
+elif 'WiPy' in mch:
sd_pins = ('GP10', 'GP11', 'GP15')
else:
raise Exception('Board not supported!')
diff --git a/tests/wipy/spi.py b/tests/wipy/spi.py
index c5f845e0e5..6bd7aabce1 100644
--- a/tests/wipy/spi.py
+++ b/tests/wipy/spi.py
@@ -2,13 +2,13 @@
SPI test for the CC3200 based boards.
'''
-from pyb import SPI
+from machine import SPI
import os
-machine = os.uname().machine
-if 'LaunchPad' in machine:
+mch = os.uname().machine
+if 'LaunchPad' in mch:
spi_pins = ('GP14', 'GP16', 'GP30')
-elif 'WiPy' in machine:
+elif 'WiPy' in mch:
spi_pins = ('GP14', 'GP16', 'GP30')
else:
raise Exception('Board not supported!')
diff --git a/tests/wipy/uart.py b/tests/wipy/uart.py
index a69300d8f6..2e8bb07477 100644
--- a/tests/wipy/uart.py
+++ b/tests/wipy/uart.py
@@ -3,16 +3,16 @@ UART test for the CC3200 based boards.
UART0 and UART1 must be connected together for this test to pass.
'''
-from pyb import UART
-from pyb import Pin
+from machine import UART
+from machine import Pin
import os
import time
-machine = os.uname().machine
-if 'LaunchPad' in machine:
+mch = os.uname().machine
+if 'LaunchPad' in mch:
uart_id_range = range(0, 2)
uart_pins = [[('GP12', 'GP13'), ('GP12', 'GP13', 'GP7', 'GP6')], [('GP16', 'GP17'), ('GP16', 'GP17', 'GP7', 'GP6')]]
-elif 'WiPy' in machine:
+elif 'WiPy' in mch:
uart_id_range = range(0, 2)
uart_pins = [[('GP12', 'GP13'), ('GP12', 'GP13', 'GP7', 'GP6')], [('GP16', 'GP17'), ('GP16', 'GP17', 'GP7', 'GP6')]]
else:
diff --git a/tests/wipy/uart_irq.py b/tests/wipy/uart_irq.py
index 322be9e8b5..d4cd900585 100644
--- a/tests/wipy/uart_irq.py
+++ b/tests/wipy/uart_irq.py
@@ -2,14 +2,14 @@
UART IRQ test for the CC3200 based boards.
'''
-from pyb import UART
+from machine import UART
import os
import time
-machine = os.uname().machine
-if 'LaunchPad' in machine:
+mch = os.uname().machine
+if 'LaunchPad' in mch:
uart_pins = [[('GP12', 'GP13'), ('GP12', 'GP13', 'GP7', 'GP6')], [('GP16', 'GP17'), ('GP16', 'GP17', 'GP7', 'GP6')]]
-elif 'WiPy' in machine:
+elif 'WiPy' in mch:
uart_pins = [[('GP12', 'GP13'), ('GP12', 'GP13', 'GP7', 'GP6')], [('GP16', 'GP17'), ('GP16', 'GP17', 'GP7', 'GP6')]]
else:
raise Exception('Board not supported!')
diff --git a/tests/wipy/wdt.py b/tests/wipy/wdt.py
index 8e07fd8314..a894b88fd8 100644
--- a/tests/wipy/wdt.py
+++ b/tests/wipy/wdt.py
@@ -2,7 +2,7 @@
WDT test for the CC3200 based boards
'''
-from pyb import WDT
+from machine import WDT
import time
# test the invalid cases first
diff --git a/tests/wipy/wlan/wlan.py b/tests/wipy/wlan/wlan.py
index d4f9b9fa94..8d2537511b 100644
--- a/tests/wipy/wlan/wlan.py
+++ b/tests/wipy/wlan/wlan.py
@@ -6,10 +6,9 @@ from network import WLAN
import os
import time
import testconfig
-import pyb
-machine = os.uname().machine
-if not 'LaunchPad' in machine and not 'WiPy' in machine:
+mch = os.uname().machine
+if not 'LaunchPad' in mch and not 'WiPy' in mch:
raise Exception('Board not supported!')