为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

翻翻过去那场雪 2023-04-20 19:15:31
STM32的RTC库函数中RTC_WaitForSynchro和RTC_WaitForLastTask是不是等价的?
查看完整描述

1 回答

?
小唯快跑啊

TA贡献1863条经验 获得超2个赞

不是的,两个函数的功能是不一样的,可以参考"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)
{
}
}


查看完整回答
反对 回复 2023-04-23
  • 1 回答
  • 0 关注
  • 103 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信