This commit is contained in:
King Kévin 2016-06-11 20:13:58 +02:00
parent 28fe6d0134
commit 9f938c1303
1 changed files with 3 additions and 3 deletions

View File

@ -120,15 +120,15 @@ uint8_t* rtc_dcf77_time(void)
return NULL;
}
to_return[2] = 1*((rtc_dcf77_frame>>36)&(0x1))+2*((rtc_dcf77_frame>>37)&(0x1))+4*((rtc_dcf77_frame>>38)&(0x1))+8*((rtc_dcf77_frame>>39)&(0x1))+10*((rtc_dcf77_frame>>40)&(0x1))+20*((rtc_dcf77_frame>>34)&(0x41)); // read day of the month (01-31)
if (ro_return[2]==0 || to_return[2]>31) { // day of the month should be 1-31
if (to_return[2]==0 || to_return[2]>31) { // day of the month should be 1-31
return NULL;
}
to_return[3] = 1*((rtc_dcf77_frame>>42)&(0x1))+2*((rtc_dcf77_frame>>43)&(0x1))+4*((rtc_dcf77_frame>>44)&(0x1)); // read day of the week (1=Monday - 7=Sunday)
if (ro_return[3]==0 || to_return[3]>7) { // day of the week should be 1-7
if (to_return[3]==0 || to_return[3]>7) { // day of the week should be 1-7
return NULL;
}
to_return[4] = 1*((rtc_dcf77_frame>>45)&(0x1))+2*((rtc_dcf77_frame>>46)&(0x1))+4*((rtc_dcf77_frame>>47)&(0x1))+8*((rtc_dcf77_frame>>48)&(0x1))+10*((rtc_dcf77_frame>>49)&(0x1)); // read month of the year (01-12)
if (ro_return[4]==0 || to_return[4]>12) { // month of the year should be 1-12
if (to_return[4]==0 || to_return[4]>12) { // month of the year should be 1-12
return NULL;
}
to_return[5] = 1*((rtc_dcf77_frame>>50)&(0x1))+2*((rtc_dcf77_frame>>51)&(0x1))+4*((rtc_dcf77_frame>>52)&(0x1))+8*((rtc_dcf77_frame>>53)&(0x1))+10*((rtc_dcf77_frame>>54)&(0x1))+20*((rtc_dcf77_frame>>55)&(0x1))+40*((rtc_dcf77_frame>>56)&(0x1))+80*((rtc_dcf77_frame>>57)&(0x1)); // read year of the century (00-99)