summaryrefslogtreecommitdiff
path: root/tests/wipy/rtc_irq.py
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/wipy/rtc_irq.py
parent0a7e4fa5cee7dcb6ce060bef37d4eae5e6f06503 (diff)
cc3200: Rename pyb module to machine.
Diffstat (limited to 'tests/wipy/rtc_irq.py')
-rw-r--r--tests/wipy/rtc_irq.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/wipy/rtc_irq.py b/tests/wipy/rtc_irq.py
index 2d4eaacab..ec3baa552 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)