From fa391eed9d2598b05ed7e0e10d38d7b597abcd19 Mon Sep 17 00:00:00 2001 From: Damien George <damien.p.george@gmail.com> Date: Tue, 6 Oct 2015 23:39:57 +0100 Subject: [PATCH] stmhal: In RTC.wakeup, fix setting of wucksel to get correct period. Thanks to Peter Hinch. See issue #1490. --- stmhal/rtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stmhal/rtc.c b/stmhal/rtc.c index 00821cabb..91dae0d6e 100644 --- a/stmhal/rtc.c +++ b/stmhal/rtc.c @@ -464,7 +464,7 @@ mp_obj_t pyb_rtc_wakeup(mp_uint_t n_args, const mp_obj_t *args) { // set WUTIE to enable wakeup interrupts // set WUTE to enable wakeup // program WUCKSEL - RTC->CR |= (1 << 14) | (1 << 10) | (wucksel & 7); + RTC->CR = (RTC->CR & ~7) | (1 << 14) | (1 << 10) | (wucksel & 7); // enable register write protection RTC->WPR = 0xff; -- GitLab