传说STM32有一个32位的秒计数器,只要电池电量充足就可以累加,我用的器件是STM32F4的mcu,这个32位的寄存器可以被读出来吗?
还有就是,日历功能,
/** Initialize RTC and set the Time and Date
*/
sTime.Hours = 0x0;
sTime.Minutes = 0x0;
sTime.Seconds = 0x0;
sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
sTime.StoreOperation = RTC_STOREOPERATION_SET;
if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
sDate.WeekDay = RTC_WEEKDAY_MONDAY;
sDate.Month = RTC_MONTH_JANUARY;
sDate.Date = 0x1;
sDate.Year = 0;
if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BCD) != HAL_OK)
{
Error_Handler();
}
这其中的HAL_RTC_SetTime和HAL_RTC_SetDate函数设置以后,可以被保存到RTC的寄存器中吗?
HAL_RTC_GetTime和HAL_RTC_GetDate函数是不是可以自动计算日期?
|