summaryrefslogtreecommitdiff
path: root/tests/wipy/skipped/rtc_irq.py
diff options
context:
space:
mode:
authorDavid Lechner <david@lechnology.com>2020-03-22 21:26:08 -0500
committerDamien George <damien.p.george@gmail.com>2020-03-30 13:21:58 +1100
commit3dc324d3f1312e40d3a8ed87e7244966bb756f26 (patch)
tree94ff44f8eabba0039582c245b901173597edd11e /tests/wipy/skipped/rtc_irq.py
parent488613bca6c460340ed2995ae5cafafe22d0bfff (diff)
tests: Format all Python code with black, except tests in basics subdir.
This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
Diffstat (limited to 'tests/wipy/skipped/rtc_irq.py')
-rw-r--r--tests/wipy/skipped/rtc_irq.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/wipy/skipped/rtc_irq.py b/tests/wipy/skipped/rtc_irq.py
index ec3baa552..99712f8d1 100644
--- a/tests/wipy/skipped/rtc_irq.py
+++ b/tests/wipy/skipped/rtc_irq.py
@@ -1,6 +1,6 @@
-'''
+"""
RTC IRQ test for the CC3200 based boards.
-'''
+"""
from machine import RTC
import machine
@@ -8,21 +8,25 @@ import os
import time
mch = os.uname().machine
-if not 'LaunchPad' in mch and not 'WiPy' in mch:
- raise Exception('Board not supported!')
+if not "LaunchPad" in mch and not "WiPy" in mch:
+ raise Exception("Board not supported!")
+
def rtc_ticks_ms(rtc):
timedate = rtc.now()
return (timedate[5] * 1000) + (timedate[6] // 1000)
+
rtc_irq_count = 0
-def alarm_handler (rtc_o):
+
+def alarm_handler(rtc_o):
global rtc_irq
global rtc_irq_count
if rtc_irq.flags() & RTC.ALARM0:
rtc_irq_count += 1
+
rtc = RTC()
rtc.alarm(time=500, repeat=True)
rtc_irq = rtc.irq(trigger=RTC.ALARM0, handler=alarm_handler)
@@ -81,9 +85,9 @@ while rtc_irq_count < 3:
try:
rtc_irq = rtc.irq(trigger=10, handler=alarm_handler)
except:
- print('Exception')
+ print("Exception")
try:
rtc_irq = rtc.irq(trigger=RTC.ALARM0, wake=1789456)
except:
- print('Exception')
+ print("Exception")