PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
C:/pdl_v10/library/driver/rtc/rtc.c File Reference
#include "rtc.h"
Include dependency graph for rtc.c:

Go to the source code of this file.

Defines

#define RTC_TIMEOUT   (SystemCoreClock/10)
#define RTC_ERR   (-1)
#define DecToBcd(x)   ((((x)/10)<<4) + ((x)%10))
#define BcdToDec(x)   ((((x)>>4)*10) + ((x)&0x0F))

Functions

static void RtcToTm (stc_rtc_time_t *pstcRtcTime, struct tm *pstcTime)
 Convert RTC time structure to time.h tm structure.
static void RtcDisableNvic (void)
 Disable RTC NVIC and save original value.
static void RtcRestoreNvic (void)
 Restore RTC NVIC.
static void RtcInitIrq (void)
 Device dependent initialization of interrupts according CMSIS with level defined in pdl_user.h.
static void RtcDeInitIrq (void)
 Device dependent de-initialization of interrupts according CMSIS with level defined in pdl.h.
void Rtc_IrqHandler (void)
 RTC interrupt service routine.
en_result_t Rtc_EnableInt (stc_rtc_int_sel_t *pstcIntSel, stc_rtc_int_cb_t *pstcIntCb)
 Enable RTC (and Timer) Interrupts.
en_result_t Rtc_DisableInt (stc_rtc_int_sel_t *pstcIntSel)
 Disable RTC (and Timer) Interrupts.
en_result_t Rtc_Init (stc_rtc_config_t *pstcConfig)
 Initialize RTC.
en_result_t Rtc_DeInit (void)
 De-Initialize RTC.
en_result_t Rtc_EnableFunc (en_rtc_func_t enFunc)
 Enable functions of RTC.
en_result_t Rtc_DisableFunc (en_rtc_func_t enFunc)
 Disable functions of RTC.
boolean_t Rtc_GetStatus (en_rtc_status_t enStatus)
 Get status of RTC according to status type.
en_result_t Rtc_ClrStatus (en_rtc_status_t enStatus)
 Clear status of RTC according to status type.
void Rtc_Reset (void)
 Reset RTC.
en_result_t Rtc_SetDateTime (stc_rtc_time_t *pstcTimeDate, boolean_t bContinue)
 Set time and date after RTC is running.
en_result_t Rtc_ReadDateTime (stc_rtc_time_t *pstcTimeDate)
 Read RTC time and date.
en_result_t Rtc_SetAlarmDateTime (stc_rtc_alarm_t *pstcAlarm)
 Set time and date information of Alarm.
en_result_t Rtc_GetAlarmDateTime (stc_rtc_alarm_t *pstcAlarm)
 Get time and date information of Alarm.
en_result_t Rtc_SetDayOfWeek (stc_rtc_time_t *pstcRtcTime)
 Set Day of the Week.
en_result_t Rtc_SetTimerCycle (uint32_t u32TimerCycle)
 Set cycle of RTC timer.
en_result_t Rtc_SetFreqCorrValue (uint16_t u16Value)
 Set calibration value of RTC frequency correction module.

Variables

static stc_rtc_intern_data_t stcRtcInternData
static uint32_t u32NvicData

Detailed Description

A detailed description is available at RTC Module description

History:

  • 2014-02-04 1.0 Edison Zhang First version.
  • 2014-03-10 1.1 Edison Zhang Update compare value of frequency correction cycle in Rtc_Init()

Definition in file rtc.c.