猿问

函数功能解释是一样的,RTC配置的时候是不是调用一句就行了?

STM32的RTC库函数中RTC_WaitForSynchro和RTC_WaitForLastTask是不是等价的?

翻翻过去那场雪
浏览 151回答 1
1回答

小唯快跑啊

不是的,两个函数的功能是不一样的,可以参考"stm32f10x_rtc.c"/*** @brief Waits until last write operation on RTC registers has finished.* @note This function must be called before any write to RTC registers.* @param None* @retval None*/void RTC_WaitForLastTask(void){/* Loop until RTOFF flag is set */while ((RTC->CRL & RTC_FLAG_RTOFF) == (uint16_t)RESET){}}/*** @brief Waits until the RTC registers (RTC_CNT, RTC_ALR and RTC_PRL)* are synchronized with RTC APB clock.* @note This function must be called before any read operation after an APB reset* or an APB clock stop.* @param None* @retval None*/void RTC_WaitForSynchro(void){/* Clear RSF flag */RTC->CRL &= (uint16_t)~RTC_FLAG_RSF;/* Loop until RSF flag is set */while ((RTC->CRL & RTC_FLAG_RSF) == (uint16_t)RESET){}}
随时随地看视频慕课网APP
我要回答