diff options
author | Damien George <damien.p.george@gmail.com> | 2018-02-05 15:22:15 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-02-05 15:22:15 +1100 |
commit | 12464f1bd2c63af012d1ce47c79f9afbfefd71e2 (patch) | |
tree | 8fb5a4ef76b753fafc1b634e2ea1f2ee02ce4a66 | |
parent | 011d1555cb12d23b68085671d903f22bac331942 (diff) |
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.
-rw-r--r-- | ports/stm32/rtc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/stm32/rtc.c b/ports/stm32/rtc.c index de4988994..fa4a3d40c 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; |