git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7011 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2014-07-06 21:12:50 +00:00
parent 9b9e7833b1
commit 04683ac245
1 changed files with 8 additions and 0 deletions

View File

@ -132,6 +132,14 @@ static void rtc_decode_time(uint32_t tr, RTCDateTime *timespec) {
*/
static void rtc_decode_date(uint32_t dr, RTCDateTime *timespec) {
timespec->year = RTC_BASE_YEAR +
(((dr >> RTC_DR_YT_OFFSET) & 15) * 10) +
((dr >> RTC_DR_YU_OFFSET) & 15);
timespec->month = (((dr >> RTC_TR_MNT_OFFSET) & 1) * 10) +
((dr >> RTC_TR_MNU_OFFSET) & 15);
timespec->day = (((dr >> RTC_DR_DT_OFFSET) & 3) * 10) +
((dr >> RTC_DR_DU_OFFSET) & 15);
timespec->dayofweek = (dr >> RTC_DR_WDU_OFFSET) & 1;
}
/**