aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-03-09 18:33:26 +0000
committerbarthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-03-09 18:33:26 +0000
commit3c311dfe589b6a6b1fd46af2e3138512fe2135fa (patch)
treecda6528f0bfc9523d6c72ce4f43934feaf023bd1 /testhal
parent2b35b5a2a5a9484332edebaca861a87910cf6715 (diff)
downloadChibiOS-3c311dfe589b6a6b1fd46af2e3138512fe2135fa.tar.gz
ChibiOS-3c311dfe589b6a6b1fd46af2e3138512fe2135fa.tar.bz2
ChibiOS-3c311dfe589b6a6b1fd46af2e3138512fe2135fa.zip
RTC. High level staff moved to chrtclib.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/sdc_dev2@4032 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32F1xx/RTC/Makefile1
-rw-r--r--testhal/STM32F1xx/RTC/main.c2
-rw-r--r--testhal/STM32F4xx/RTC/Makefile1
-rw-r--r--testhal/STM32F4xx/RTC/main.c10
-rwxr-xr-xtesthal/STM32F4xx/SDC/Makefile1
5 files changed, 9 insertions, 6 deletions
diff --git a/testhal/STM32F1xx/RTC/Makefile b/testhal/STM32F1xx/RTC/Makefile
index 9fc777248..3d28124f2 100644
--- a/testhal/STM32F1xx/RTC/Makefile
+++ b/testhal/STM32F1xx/RTC/Makefile
@@ -79,6 +79,7 @@ CSRC = $(PORTSRC) \
$(BOARDSRC) \
$(CHIBIOS)/os/various/evtimer.c \
$(CHIBIOS)/os/various/syscalls.c \
+ $(CHIBIOS)/os/various/chrtclib.c \
main.c \
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
diff --git a/testhal/STM32F1xx/RTC/main.c b/testhal/STM32F1xx/RTC/main.c
index bd3faa493..380afdad3 100644
--- a/testhal/STM32F1xx/RTC/main.c
+++ b/testhal/STM32F1xx/RTC/main.c
@@ -21,6 +21,8 @@
#include "ch.h"
#include "hal.h"
+#include "chrtclib.h"
+
RTCTime timespec;
RTCAlarm alarmspec;
diff --git a/testhal/STM32F4xx/RTC/Makefile b/testhal/STM32F4xx/RTC/Makefile
index e60937914..82511a750 100644
--- a/testhal/STM32F4xx/RTC/Makefile
+++ b/testhal/STM32F4xx/RTC/Makefile
@@ -81,6 +81,7 @@ CSRC = $(PORTSRC) \
$(CHIBIOS)/os/various/syscalls.c \
$(CHIBIOS)/os/various/shell.c \
$(CHIBIOS)/os/various/chprintf.c \
+ $(CHIBIOS)/os/various/chrtclib.c \
main.c \
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
diff --git a/testhal/STM32F4xx/RTC/main.c b/testhal/STM32F4xx/RTC/main.c
index 5bc51c7b6..ce3e7f13f 100644
--- a/testhal/STM32F4xx/RTC/main.c
+++ b/testhal/STM32F4xx/RTC/main.c
@@ -43,11 +43,11 @@ int tm_isdst daylight savings indicator (1 = yes, 0 = no, -1 = unknown)
#include "shell.h"
#include "chprintf.h"
+#include "chrtclib.h"
#if WAKEUP_TEST
static RTCWakeup wakeupspec;
#endif
-static RTCTime timespec = {0,0,FALSE,0};
static RTCAlarm alarmspec;
static time_t unix_time;
@@ -147,15 +147,14 @@ static void cmd_date(BaseChannel *chp, int argc, char *argv[]){
}
if ((argc == 1) && (strcmp(argv[0], "get") == 0)){
- rtcGetTime(&RTCD1, &timespec);
- stm32_rtc_bcd2tm(&timp, &timespec);
- unix_time = mktime(&timp);
+ unix_time = rtcGetTimeUnixSec(&RTCD1);
if (unix_time == -1){
chprintf(chp, "incorrect time in RTC cell\r\n");
}
else{
chprintf(chp, "%D%s",unix_time," - unix time\r\n");
+ rtcGetTimeTm(&RTCD1, &timp);
chprintf(chp, "%s%s",asctime(&timp)," - formatted time string\r\n");
}
return;
@@ -164,8 +163,7 @@ static void cmd_date(BaseChannel *chp, int argc, char *argv[]){
if ((argc == 2) && (strcmp(argv[0], "set") == 0)){
unix_time = atol(argv[1]);
if (unix_time > 0){
- stm32_rtc_tm2bcd((localtime(&unix_time)), &timespec);
- rtcSetTime(&RTCD1, &timespec);
+ rtcSetTimeUnixSec(&RTCD1, unix_time);
return;
}
else{
diff --git a/testhal/STM32F4xx/SDC/Makefile b/testhal/STM32F4xx/SDC/Makefile
index ed147a37e..cf4d7b333 100755
--- a/testhal/STM32F4xx/SDC/Makefile
+++ b/testhal/STM32F4xx/SDC/Makefile
@@ -86,6 +86,7 @@ CSRC = $(PORTSRC) \
$(CHIBIOS)/os/various/syscalls.c \
$(CHIBIOS)/os/various/shell.c \
$(CHIBIOS)/os/various/chprintf.c \
+ $(CHIBIOS)/os/various/chrtclib.c \
main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global