mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #15034 from world-direct/feature/stm32f1_rtcHSE
add RTC using HSE to target STM32F1pull/15029/head
commit
ff0e682d80
|
@ -292,7 +292,11 @@ void mbed_sdk_init()
|
|||
#if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE)
|
||||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
|
||||
#if defined(RCC_RTCCLKSOURCE_HSE_DIVX)
|
||||
PeriphClkInitStruct.RTCClockSelection = (RCC_RTCCLKSOURCE_HSE_DIVX | RTC_HSE_DIV << 16);
|
||||
#else
|
||||
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_HSE_DIV128;
|
||||
#endif
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
|
||||
error("PeriphClkInitStruct RTC failed with HSE\n");
|
||||
}
|
||||
|
|
|
@ -65,7 +65,11 @@ void rtc_init(void)
|
|||
#if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE)
|
||||
(void)RCC_OscInitStruct;
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
|
||||
#if defined(RCC_RTCCLKSOURCE_HSE_DIVX)
|
||||
PeriphClkInitStruct.RTCClockSelection = (RCC_RTCCLKSOURCE_HSE_DIVX | RTC_HSE_DIV << 16);
|
||||
#else
|
||||
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_HSE_DIV128;
|
||||
#endif
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
|
||||
error("PeriphClkInitStruct RTC failed with HSE\n");
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ extern "C" {
|
|||
#error "RTC clock configuration is invalid!"
|
||||
#endif
|
||||
|
||||
#if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE) && !(TARGET_STM32F2 || TARGET_STM32F4 || TARGET_STM32F7)
|
||||
#if (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_HSE) && !(TARGET_STM32F2 || TARGET_STM32F4 || TARGET_STM32F7 || TARGET_STM32F1)
|
||||
#error "RTC from HSE not supported for this target"
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue