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
RTC.cpp@12:a89096944f20, 2016-01-31 (annotated)
- Committer:
- the_sz
- Date:
- Sun Jan 31 01:02:36 2016 +0000
- Revision:
- 12:a89096944f20
date adjust added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
the_sz | 12:a89096944f20 | 1 | #include "WakeupLight.h" |
the_sz | 12:a89096944f20 | 2 | |
the_sz | 12:a89096944f20 | 3 | void RTC_Init(void) |
the_sz | 12:a89096944f20 | 4 | { |
the_sz | 12:a89096944f20 | 5 | rtc_init(); |
the_sz | 12:a89096944f20 | 6 | } |
the_sz | 12:a89096944f20 | 7 | |
the_sz | 12:a89096944f20 | 8 | time_t RTC_Get(struct tm **tmStruct) |
the_sz | 12:a89096944f20 | 9 | { |
the_sz | 12:a89096944f20 | 10 | time_t result; |
the_sz | 12:a89096944f20 | 11 | |
the_sz | 12:a89096944f20 | 12 | // rtc_read in IAR is buggy, it converts the rtc time to local time, sometimes with, sometimes without timezone |
the_sz | 12:a89096944f20 | 13 | result=time(NULL); |
the_sz | 12:a89096944f20 | 14 | localtime(&result); |
the_sz | 12:a89096944f20 | 15 | |
the_sz | 12:a89096944f20 | 16 | result=time(NULL); |
the_sz | 12:a89096944f20 | 17 | |
the_sz | 12:a89096944f20 | 18 | DPrintf_("RTC_Get: 0x%X.\r\n",result); |
the_sz | 12:a89096944f20 | 19 | |
the_sz | 12:a89096944f20 | 20 | if (tmStruct!=NULL) |
the_sz | 12:a89096944f20 | 21 | (*tmStruct)=localtime(&result); |
the_sz | 12:a89096944f20 | 22 | |
the_sz | 12:a89096944f20 | 23 | return result; |
the_sz | 12:a89096944f20 | 24 | } |
the_sz | 12:a89096944f20 | 25 | |
the_sz | 12:a89096944f20 | 26 | void RTC_Set(struct tm *tmStruct) |
the_sz | 12:a89096944f20 | 27 | { |
the_sz | 12:a89096944f20 | 28 | time_t result; |
the_sz | 12:a89096944f20 | 29 | |
the_sz | 12:a89096944f20 | 30 | result=mktime(tmStruct); |
the_sz | 12:a89096944f20 | 31 | |
the_sz | 12:a89096944f20 | 32 | set_time(result); |
the_sz | 12:a89096944f20 | 33 | } |
the_sz | 12:a89096944f20 | 34 |