diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-03-09 18:33:26 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-03-09 18:33:26 +0000 |
commit | 3c311dfe589b6a6b1fd46af2e3138512fe2135fa (patch) | |
tree | cda6528f0bfc9523d6c72ce4f43934feaf023bd1 /testhal/STM32F4xx/RTC/main.c | |
parent | 2b35b5a2a5a9484332edebaca861a87910cf6715 (diff) | |
download | ChibiOS-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/STM32F4xx/RTC/main.c')
-rw-r--r-- | testhal/STM32F4xx/RTC/main.c | 10 |
1 files changed, 4 insertions, 6 deletions
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, ×pec);
- stm32_rtc_bcd2tm(&timp, ×pec);
- 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)), ×pec);
- rtcSetTime(&RTCD1, ×pec);
+ rtcSetTimeUnixSec(&RTCD1, unix_time);
return;
}
else{
|