- fix bug in RTC;
This commit is contained in:
mtabachenko 2009-12-21 23:42:14 +00:00
parent e89cfe3a49
commit 539aa86231
1 changed files with 7 additions and 2 deletions

View File

@ -172,7 +172,8 @@ static void rtcRecv()
rtc.data[0]=toBCD(movie.year);
rtc.data[1]=toBCD(movie.month);
rtc.data[2]=toBCD(movie.monthday);
rtc.data[3]=(movie.weekday + 6) & 7;
rtc.data[3]=(movie.weekday + 7) & 7;
if (rtc.data[3] == 7) rtc.data[3] = 0;
if (!(rtc.regStatus1 & 0x02)) movie.hour %= 12;
rtc.data[4] = ((movie.hour < 12) ? 0x00 : 0x40) | toBCD(movie.hour);
rtc.data[5]=toBCD(movie.minute);
@ -184,13 +185,15 @@ static void rtcRecv()
rtc.data[0] = toBCD(tm_local->tm_year);
rtc.data[1] = toBCD(tm_local->tm_mon);
rtc.data[2] = toBCD(tm_local->tm_mday);
rtc.data[3] = (tm_local->tm_wday + 6) & 7;
rtc.data[3] = (tm_local->tm_wday + 7) & 7;
if (rtc.data[3] == 7) rtc.data[3] = 0;
if (!(rtc.regStatus1 & 0x02)) tm_local->tm_hour %= 12;
rtc.data[4] = ((tm_local->tm_hour < 12) ? 0x00 : 0x40) | toBCD(tm_local->tm_hour);
rtc.data[5] = toBCD(tm_local->tm_min);
rtc.data[6] = toBCD(tm_local->tm_sec);
break;
}
break;
}
case 3: // time
{
@ -207,6 +210,7 @@ static void rtcRecv()
rtc.data[0] = ((movie.hour < 12) ? 0x00 : 0x40) | toBCD(movie.hour);
rtc.data[1] = toBCD(movie.minute);
rtc.data[2] = toBCD(movie.sec);
break;
}
else {
@ -216,6 +220,7 @@ static void rtcRecv()
rtc.data[2] = toBCD(tm_local->tm_sec);
break;
}
break;
}
case 4: // freq/alarm 1
/*if (cmdBitsSize[0x04] == 8)