Fixed rtc driver rtc_settime() and completed driver on PC simulator

This commit is contained in:
claudiol 2016-10-10 10:08:33 -04:00
parent 74c4b0914a
commit 4b3cb40a1a
3 changed files with 18 additions and 1 deletions

View file

@ -144,9 +144,11 @@ int rtc_settime(int hour,int min,int sec)
if(min<0 || min>59) return 0;
if(sec<0 || sec>59) return 0;
do {
__setRTCHour(hour);
__setRTCMin(min);
__setRTCSec(sec);
} while(! ((__getRTCHour()==hour) && (__getRTCMin()==min) && (__getRTCSec()==sec)));
return 1;
}

View file

@ -50,6 +50,20 @@ int rtc_getyear()
}
int rtc_getdow()
{
time_t now;
struct tm *timest;
time(&now);
timest=localtime(&now);
if(timest==NULL) return 0;
else return (timest->tm_wday==0)? 7:timest->tm_wday;
}
int rtc_getsec()
{
time_t now;

View file

@ -206,7 +206,8 @@ SOURCES += main.cpp\
newrpl/lib-48-angles.c \
newrpl/lib-74-sdcard.c \
newrpl/lib-80-fonts.c \
firmware/sys/target_pc/rtc.c
firmware/sys/target_pc/rtc.c \
firmware/hal_clock.c
HEADERS += mainwindow.h \
qemuscreen.h \