From d37f6cb1f3cac35b1f7f7373062fddb638707570 Mon Sep 17 00:00:00 2001 From: barthess Date: Sat, 1 Nov 2014 15:44:30 +0000 Subject: RTCv1. Time converstion functions moved to rtc.c(h). Chrtclib deleted. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7443 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/rtc.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'os/hal/include') diff --git a/os/hal/include/rtc.h b/os/hal/include/rtc.h index a775ec570..a0f02b502 100644 --- a/os/hal/include/rtc.h +++ b/os/hal/include/rtc.h @@ -87,8 +87,20 @@ */ typedef struct RTCDriver RTCDriver; -#include "chrtclib.h" +/** + * @brief Type of a structure representing an RTC date/time stamp. + */ +typedef struct { + uint32_t year: 8; /**< @brief Years since 1980. */ + uint32_t month: 4; /**< @brief Months 1..12. */ + uint32_t dstflag: 1; /**< @brief DST correction flag. */ + uint32_t dayofweek: 3; /**< @brief Day of week 1..7. */ + uint32_t day: 5; /**< @brief Day of the month 1..31. */ + uint32_t millisecond: 27; /**< @brief Milliseconds since midnight.*/ +} RTCDateTime; + #include "rtc_lld.h" +#include /*===========================================================================*/ /* Driver macros. */ @@ -113,6 +125,11 @@ extern "C" { #if RTC_SUPPORTS_CALLBACKS void rtcSetCallback(RTCDriver *rtcp, rtccb_t callback); #endif + void rtcConvertDateTimeToStructTm(const RTCDateTime *timespec, + struct tm *timp); + void rtcConvertStructTmToDateTime(const struct tm *timp, + uint32_t tv_msec, RTCDateTime *timespec); + uint32_t rtcConvertDateTimeToFAT(const RTCDateTime *timespec); #ifdef __cplusplus } #endif -- cgit v1.2.3