Wakeup Light with touch user interface, anti-aliased Font, SD card access and RTC usage on STM32F746NG-DISCO board
Dependencies: BSP_DISCO_F746NG_patch_fixed LCD_DISCO_F746NG TS_DISCO_F746NG FATFileSystem TinyJpgDec_interwork mbed-src
Diff: RTC.cpp
- Revision:
- 12:a89096944f20
diff -r 3c6366ea1021 -r a89096944f20 RTC.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RTC.cpp Sun Jan 31 01:02:36 2016 +0000 @@ -0,0 +1,34 @@ +#include "WakeupLight.h" + +void RTC_Init(void) +{ + rtc_init(); +} + +time_t RTC_Get(struct tm **tmStruct) +{ + time_t result; + + // rtc_read in IAR is buggy, it converts the rtc time to local time, sometimes with, sometimes without timezone + result=time(NULL); + localtime(&result); + + result=time(NULL); + + DPrintf_("RTC_Get: 0x%X.\r\n",result); + + if (tmStruct!=NULL) + (*tmStruct)=localtime(&result); + + return result; +} + +void RTC_Set(struct tm *tmStruct) +{ + time_t result; + + result=mktime(tmStruct); + + set_time(result); +} + \ No newline at end of file