代码300ms读一次,不断的读,没有任何写操作。
void BSP_RTC_time_Get( hw_rtc *p )
{
uint32_t time_subsecond = 0;
rtc_parameter_struct rtc_read;
rtc_current_time_get(&rtc_read);
time_subsecond = rtc_subsecond_get();
time_subsecond = (1000 - (time_subsecond*1000+1000)/400);
p->tm_year = RTC_BCDToByte(rtc_read.year); // form 2000
p->tm_mon = rtc_read.month;
p->tm_mday = RTC_BCDToByte(rtc_read.date);
p->tm_hour = RTC_BCDToByte(rtc_read.hour);
p->tm_min = RTC_BCDToByte(rtc_read.minute);
p->tm_sec = RTC_BCDToByte(rtc_read.second);
p->tm_subsec = time_subsecond;
}
|