aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorblmorris2015-05-07 13:18:52 -0400
committerDamien George2015-05-11 23:48:39 +0100
commit5df81de7afbf4e9f24413ba957f4a7cce89fa1e0 (patch)
treeccca10c22524a909c28651ae00698bbcb91cfd88 /tests
parenta7c02c4538bb2b986efb1999e00da4d76345767d (diff)
sthmal/rtc.c: Add calibration() method to get/set RTC fine-tuning value.
Diffstat (limited to 'tests')
-rw-r--r--tests/pyb/rtc.py21
-rw-r--r--tests/pyb/rtc.py.exp9
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/pyb/rtc.py b/tests/pyb/rtc.py
index f2c96f160..001553ac3 100644
--- a/tests/pyb/rtc.py
+++ b/tests/pyb/rtc.py
@@ -28,3 +28,24 @@ set_and_print((2016, 12, 31, 7, 23, 59, 0, 0))
set_and_print((2016, 12, 31, 7, 23, 59, 1, 0))
set_and_print((2016, 12, 31, 7, 23, 59, 59, 0))
set_and_print((2099, 12, 31, 7, 23, 59, 59, 0))
+
+# check that calibration works correctly
+# save existing calibration value:
+cal_tmp = rtc.calibration()
+
+def set_and_print_calib(cal):
+ rtc.calibration(cal)
+ print(rtc.calibration())
+
+set_and_print_calib(512)
+set_and_print_calib(511)
+set_and_print_calib(345)
+set_and_print_calib(1)
+set_and_print_calib(0)
+set_and_print_calib(-1)
+set_and_print_calib(-123)
+set_and_print_calib(-510)
+set_and_print_calib(-511)
+
+# restore existing calibration value
+rtc.calibration(cal_tmp)
diff --git a/tests/pyb/rtc.py.exp b/tests/pyb/rtc.py.exp
index 43ea70d95..d8d5e0f0a 100644
--- a/tests/pyb/rtc.py.exp
+++ b/tests/pyb/rtc.py.exp
@@ -14,3 +14,12 @@
(2016, 12, 31, 7, 23, 59, 1)
(2016, 12, 31, 7, 23, 59, 59)
(2099, 12, 31, 7, 23, 59, 59)
+512
+511
+345
+1
+0
+-1
+-123
+-510
+-511