diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-04-17 18:09:27 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-04-17 18:09:27 +0000 |
commit | 72e66cd47c5f003b97b2c78edf86b900257c0e65 (patch) | |
tree | e9855a128f7ecdd0a5aae9170762e5c7efb2753f /testhal/STM32F4xx/RTC/main.c | |
parent | c53f70238122ce394eb45aa471feebc54515b9ca (diff) | |
parent | 469211b330aaa187de511a8e3963feac1db51053 (diff) | |
download | ChibiOS-72e66cd47c5f003b97b2c78edf86b900257c0e65.tar.gz ChibiOS-72e66cd47c5f003b97b2c78edf86b900257c0e65.tar.bz2 ChibiOS-72e66cd47c5f003b97b2c78edf86b900257c0e65.zip |
SDC. Merged code from development branch.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4106 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{
|