mirror of
https://git.code.sf.net/p/newrpl/sources
synced 2024-11-16 19:51:25 +01:00
Fixed rtc driver rtc_settime() and completed driver on PC simulator
This commit is contained in:
parent
74c4b0914a
commit
4b3cb40a1a
3 changed files with 18 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 \
|
||||
|
|
Loading…
Reference in a new issue