From 12464f1bd2c63af012d1ce47c79f9afbfefd71e2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 5 Feb 2018 15:22:15 +1100 Subject: [PATCH] stm32/rtc: Add compile-time option to set RTC source as LSE bypass. To use the LSE bypass feature (where an external source provides the RTC clock) a board must set the config variable MICROPY_HW_RTC_USE_BYPASS. --- ports/stm32/rtc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/stm32/rtc.c b/ports/stm32/rtc.c index de49889949..fa4a3d40c1 100644 --- a/ports/stm32/rtc.c +++ b/ports/stm32/rtc.c @@ -335,7 +335,11 @@ STATIC void PYB_RTC_MspInit_Kick(RTC_HandleTypeDef *hrtc, bool rtc_use_lse) { RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI | RCC_OSCILLATORTYPE_LSE; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; if (rtc_use_lse) { + #if MICROPY_HW_RTC_USE_BYPASS + RCC_OscInitStruct.LSEState = RCC_LSE_BYPASS; + #else RCC_OscInitStruct.LSEState = RCC_LSE_ON; + #endif RCC_OscInitStruct.LSIState = RCC_LSI_OFF; } else { RCC_OscInitStruct.LSEState = RCC_LSE_OFF;