summaryrefslogtreecommitdiff
path: root/tests/pyb/rtc.py
diff options
context:
space:
mode:
authorblmorris <bryan.morrissey@gmail.com>2015-05-07 13:18:52 -0400
committerDamien George <damien.p.george@gmail.com>2015-05-11 23:48:39 +0100
commit5df81de7afbf4e9f24413ba957f4a7cce89fa1e0 (patch)
treeccca10c22524a909c28651ae00698bbcb91cfd88 /tests/pyb/rtc.py
parenta7c02c4538bb2b986efb1999e00da4d76345767d (diff)
sthmal/rtc.c: Add calibration() method to get/set RTC fine-tuning value.
Diffstat (limited to 'tests/pyb/rtc.py')
-rw-r--r--tests/pyb/rtc.py21
1 files changed, 21 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)