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

Committer:
the_sz
Date:
2016-01-31
Revision:
12:a89096944f20

File content as of revision 12:a89096944f20:

#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);
}