请高手帮忙,我在设置时间时用以下函数,可是调用RTC_SetCounter(seconds)后程序就死在RTC_WaitForLastTask()上了,不知道是为什么?请高手帮个忙? void time_adjust(ULONG seconds) { /* Wait until last write operation on RTC registers has finished */ RTC_WaitForLastTask(); /* Change the current time */ RTC_SetCounter(seconds); /* Wait until last write operation on RTC registers has finished */ RTC_WaitForLastTask(); }
void RTC_SetCounter(u32 CounterValue) { RTC_EnterConfigMode();
/* Set RTC COUNTER MSB word */ RTC->CNTH = CounterValue >> 16; /* Set RTC COUNTER LSB word */ RTC->CNTL = (CounterValue & RTC_LSB_Mask);
RTC_ExitConfigMode(); }
void RTC_WaitForLastTask(void) { /* Loop until RTOFF flag is set */ while ((RTC->CRL & RTC_FLAG_RTOFF) == (u16)RESET) { } } |