printf("\r\n==============Time Settings=====================================");
printf("\r\n Please Set Hours");
while (Tmp_HH == 0xFF)
{
Tmp_HH = USART_Scanf(23);
}
printf(": %d", Tmp_HH);
printf("\r\n Please Set Minutes");
while (Tmp_MM == 0xFF)
{
Tmp_MM = USART_Scanf(59);
}
printf(": %d", Tmp_MM);
printf("\r\n Please Set Seconds");
while (Tmp_SS == 0xFF)
{
Tmp_SS = USART_Scanf(59);
}
printf(": %d", Tmp_SS);
/* Return the value to store in RTC counter register */
return((Tmp_HH*3600 + Tmp_MM*60 + Tmp_SS));
}
/*
* 函数名:Time_Adjust
* 描述 :时间调节
* 输入 :无
* 输出 :无
* 调用 :外部调用
*/
void Time_Adjust(void)
{
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
/* Change the current time */
RTC_SetCounter(Time_Regulate());
/* Wait until last write operation on RTC registers has finished */
RTC_WaitForLastTask();
}
/* Infinite loop */
while (1)
{
/* If 1s has paased */
if (TimeDisplay == 1)
{
/* Display current time */
Time_Display(RTC_GetCounter());
TimeDisplay = 0;
}
}
}