From 5df81de7afbf4e9f24413ba957f4a7cce89fa1e0 Mon Sep 17 00:00:00 2001 From: blmorris Date: Thu, 7 May 2015 13:18:52 -0400 Subject: sthmal/rtc.c: Add calibration() method to get/set RTC fine-tuning value. --- tests/pyb/rtc.py | 21 +++++++++++++++++++++ tests/pyb/rtc.py.exp | 9 +++++++++ 2 files changed, 30 insertions(+) (limited to 'tests') 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 -- cgit v1.2.3