STM32L0系列 测试基于L053 初始化- void MX_RTC_Init(void)
- {
- LL_RTC_InitTypeDef RTC_InitStruct = {0};
- /* Peripheral clock enable */
- LL_RCC_EnableRTC();
- /* RTC interrupt Init */
- NVIC_SetPriority(RTC_IRQn, 0);
- NVIC_EnableIRQ(RTC_IRQn);
- /** Initialize RTC and set the Time and Date
- */
- RTC_InitStruct.HourFormat = LL_RTC_HOURFORMAT_24HOUR;
- RTC_InitStruct.AsynchPrescaler = 127;
- RTC_InitStruct.SynchPrescaler = 255;
- LL_RTC_Init(RTC, &RTC_InitStruct);
- /** Initialize RTC and set the Time and Date
- */
- /** Enable the WakeUp
- */
- LL_RTC_DisableWriteProtection(RTC);
- LL_RTC_WAKEUP_SetClock(RTC, LL_RTC_WAKEUPCLOCK_CKSPRE);
- LL_EXTI_EnableIT_0_31(LL_EXTI_LINE_20);
- LL_EXTI_EnableRisingTrig_0_31(LL_EXTI_LINE_20);
- LL_RTC_WAKEUP_Enable(RTC);
- LL_RTC_EnableWriteProtection(RTC);
- }
|