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.
This commit is contained in:
Damien George 2018-02-05 15:22:15 +11:00
parent 011d1555cb
commit 12464f1bd2

View File

@ -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;