Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
0e87bc7b
Commit
0e87bc7b
authored
Oct 09, 2015
by
Peter Hinch
Committed by
Damien George
Oct 09, 2015
Browse files
tests: In pyb RTC tests, check wakeup register values.
parent
01d64914
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/pyb/rtc.py
View file @
0e87bc7b
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
tests/pyb/rtc.py.exp
View file @
0e87bc7b
...
...
@@ -23,3 +23,18 @@
-123
-510
-511
(3, 0)
(3, 15)
(3, 65535)
(2, 32775)
(2, 65535)
(1, 32771)
(1, 65535)
(0, 32769)
(0, 65535)
(4, 31)
(4, 65535)
(6, 0)
(6, 65534)
(6, 65535)
(-1, -1)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment