diff options
author | Peter Hinch <peter@hinch.me.uk> | 2015-10-09 07:57:17 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-10-09 23:06:05 +0100 |
commit | 0e87bc7be69c60581324e23163f14a269d33fcc7 (patch) | |
tree | 9e5cf8f9cb2f180ce8092893d43109a9e2e564f2 /tests/pyb/rtc.py | |
parent | 01d64914c5517f4207c002d931efa1e71fc210d9 (diff) |
tests: In pyb RTC tests, check wakeup register values.
Diffstat (limited to 'tests/pyb/rtc.py')
-rw-r--r-- | tests/pyb/rtc.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/pyb/rtc.py b/tests/pyb/rtc.py index 001553ac3..09af52629 100644 --- a/tests/pyb/rtc.py +++ b/tests/pyb/rtc.py @@ -1,4 +1,4 @@ -import pyb +import pyb, stm from pyb import RTC rtc = RTC() @@ -49,3 +49,30 @@ set_and_print_calib(-511) # restore existing calibration value rtc.calibration(cal_tmp) + +# Check register settings for wakeup +def set_and_print_wakeup(ms): + try: + rtc.wakeup(ms) + wucksel = stm.mem32[stm.RTC + stm.RTC_CR] & 7 + wut = stm.mem32[stm.RTC + stm.RTC_WUTR] & 0xffff + except ValueError: + wucksel = -1 + wut = -1 + print((wucksel, wut)) + +set_and_print_wakeup(0) +set_and_print_wakeup(1) +set_and_print_wakeup(4000) +set_and_print_wakeup(4001) +set_and_print_wakeup(8000) +set_and_print_wakeup(8001) +set_and_print_wakeup(16000) +set_and_print_wakeup(16001) +set_and_print_wakeup(32000) +set_and_print_wakeup(32001) +set_and_print_wakeup(0x10000*1000) +set_and_print_wakeup(0x10001*1000) +set_and_print_wakeup(0x1ffff*1000) +set_and_print_wakeup(0x20000*1000) +set_and_print_wakeup(0x20001*1000) # exception |