diff options
| author | [email protected] <[email protected]> | 2012-06-25 09:02:46 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-06-25 09:02:46 +0000 |
| commit | d20343a87d03bf00aca88945faff4dee68428937 (patch) | |
| tree | 3c5c6f7bf1199c1aee4c55d20e0be9adb56e8e35 | |
| parent | 2c45dc204148124736eb93b010b4ea5152e61ed6 (diff) | |
using RTC API from RTC device driver framework
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2183 bbd45198-f89e-11dd-88c7-29a3b14d5316
| -rw-r--r-- | bsp/efm32/drv_rtc.c | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/bsp/efm32/drv_rtc.c b/bsp/efm32/drv_rtc.c index 3bd41ba1cc..cced103afc 100644 --- a/bsp/efm32/drv_rtc.c +++ b/bsp/efm32/drv_rtc.c @@ -225,103 +225,6 @@ void rt_hw_rtc_init(void) rt_hw_rtc_register(&rtc, RT_RTC_NAME, EFM32_NO_DATA);
}
-/***************************************************************************//**
- * Export to FINSH
- ******************************************************************************/
-#ifdef RT_USING_FINSH
-#include <finsh.h>
-#include <time.h>
-time_t time(time_t* t)
-{
- rt_device_t device;
- time_t time;
-
- device = rt_device_find("rtc");
- if (device != RT_NULL)
- {
- rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time);
- if (t != RT_NULL) *t = time;
- }
-
- return time;
-}
-
-void set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day)
-{
- time_t now;
- struct tm* ti;
- rt_device_t device;
-
- ti = RT_NULL;
- /* get current time */
- time(&now);
-
- ti = localtime(&now);
- if (ti != RT_NULL)
- {
- ti->tm_year = year - 1900;
- ti->tm_mon = month - 1; /* ti->tm_mon = month; */
- ti->tm_mday = day;
- }
-
- now = mktime(ti);
-
- device = rt_device_find("rtc");
- if (device != RT_NULL)
- {
- rt_rtc_control(device, RT_DEVICE_CTRL_RTC_SET_TIME, &now);
- }
-}
-FINSH_FUNCTION_EXPORT(set_date, set date. e.g: set_date(2010,2,28))
-
-void set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second)
-{
- time_t now;
- struct tm* ti;
- rt_device_t device;
-
- ti = RT_NULL;
- /* get current time */
- time(&now);
- rtc_debug("RTC: Now %x\n", now);
-
- ti = localtime(&now);
- if (ti != RT_NULL)
- {
- ti->tm_hour = hour;
- ti->tm_min = minute;
- ti->tm_sec = second;
- }
- rtc_debug("RTC: DST %d\n", ti->tm_isdst);
- rtc_debug("RTC: Days in year %d\n", ti->tm_yday);
- rtc_debug("RTC: Day of week %d\n", ti->tm_wday);
- rtc_debug("RTC: Year %d\n", ti->tm_year);
- rtc_debug("RTC: Month %d\n", ti->tm_mon);
- rtc_debug("RTC: Day %d\n", ti->tm_mday);
- rtc_debug("RTC: Hour %d\n", ti->tm_hour);
- rtc_debug("RTC: Min %d\n", ti->tm_min);
- rtc_debug("RTC: Sec %d\n", ti->tm_sec);
-
- now = mktime(ti);
- rtc_debug("RTC: Now %x\n", now);
- device = rt_device_find("rtc");
- if (device != RT_NULL)
- {
- rt_rtc_control(device, RT_DEVICE_CTRL_RTC_SET_TIME, &now);
- }
-}
-FINSH_FUNCTION_EXPORT(set_time, set time. e.g: set_time(23,59,59))
-
-void list_date()
-{
- time_t now;
-
- time(&now);
- rt_kprintf("%s\n", ctime(&now));
-}
-FINSH_FUNCTION_EXPORT(list_date, show date and time.)
-#endif
-
#endif
/***************************************************************************//**
|
