summaryrefslogtreecommitdiffstatshomepage
path: root/tests/pyb/rtc.py
diff options
context:
space:
mode:
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 f2c96f160e..001553ac31 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)