PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
C:/pdl_v10/library/driver/rtc/rtc.h File Reference
#include "mcu.h"
#include "pdl_user.h"
#include "time.h"
Include dependency graph for rtc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  stc_rtc_freq_corr
 frequency correction configuration More...
struct  stc_rtc_timer
 Real Time Clock timer configuration structure. More...
struct  stc_rtc_int_sel
 Interrupt configuration structure. More...
struct  stc_rtc_int_cb
 RTC callback functions structure. More...
struct  stc_rtc_time
 Real Time Clock Date and Time structure. More...
struct  stc_rtc_alarm
 Real Time Clock Alarm structure. More...
struct  stc_rtc_config
 Real Time Clock configuration. More...
struct  stc_rtc_intern_data
 Datatype for holding internal data needed for RTC. More...

Defines

#define RTC_MAX_FREQ_CORR_VALUE   (0x3FFu)
 Rtccallback function prototypes.
#define RTC_MAX_FREQ_CORR_CYCLE_SET_VALUE   (0x3Fu)
 Maximum Frequency Correction Cycle Setting Value.
#define RTC_MAX_TIMER_SET_VALUE   (0x20000)
 Maxmimum Timer Setting Value [unit: second].

Typedefs

typedef enum en_rtc_clk_sel en_rtc_clk_sel_t
 Real Time Clock clock selection.
typedef enum en_rtc_rtcco_sel en_rtc_rtcco_sel_t
 RTCCO output selection.
typedef struct stc_rtc_freq_corr stc_rtc_freq_corr_t
 frequency correction configuration
typedef enum en_rtc_func en_rtc_func_t
 Real Time Clock functions.
typedef enum en_rtc_day_of_week en_rtc_day_of_week_t
 Day of week name definitions.
typedef enum en_rtc_month en_rtc_month_t
 Month name definitions (not used in driver - to be used by user appliciation)
typedef enum en_rtc_time_mode en_rtc_time_mode_t
 Real Time Clock timer mode selection.
typedef struct stc_rtc_timer stc_rtc_timer_t
 Real Time Clock timer configuration structure.
typedef enum en_rtc_div_ratio en_rtc_div_ratio_t
 Rtc Divider Ratio Setting.
typedef struct stc_rtc_int_sel stc_rtc_int_sel_t
 Interrupt configuration structure.
typedef struct stc_rtc_int_cb stc_rtc_int_cb_t
 RTC callback functions structure.
typedef struct stc_rtc_time stc_rtc_time_t
 Real Time Clock Date and Time structure.
typedef enum en_rtc_status en_rtc_status_t
 Real Time Clock status types.
typedef struct stc_rtc_alarm stc_rtc_alarm_t
 Real Time Clock Alarm structure.
typedef struct stc_rtc_config stc_rtc_config_t
 Real Time Clock configuration.
typedef struct stc_rtc_intern_data stc_rtc_intern_data_t
 Datatype for holding internal data needed for RTC.

Enumerations

enum  en_rtc_clk_sel { RtcUseSubClk = 0u, RtcuseMainClk = 1u }
 Real Time Clock clock selection. More...
enum  en_rtc_rtcco_sel { RtccoOutput2Hz = 0, RtccoOutput1Hz = 1 }
 RTCCO output selection. More...
enum  en_rtc_func {
  RtcCount = 0u, RtcTimer = 1u, RtcFreqCorr = 2u, RtcAlarmYearEn = 3u,
  RtcAlarmMonthEn = 4u, RtcAlarmDayEn = 5u, RtcAlarmHourEn = 6u, RtcAlarmMinEn = 7u
}
 Real Time Clock functions. More...
enum  en_rtc_day_of_week {
  RtcSunday = 0, RtcMonday = 1, RtcTuesday = 2, RtcWednesday = 3,
  RtcThursday = 4, RtcFriday = 5, RtcSaturday = 6
}
 Day of week name definitions. More...
enum  en_rtc_month {
  RtcJanuary = 1, RtcFebuary = 2, RtcMarch = 3, RtcApril = 4,
  RtcMay = 5, RtcJune = 6, RtcJuly = 7, RtcAugust = 8,
  RtcSeptember = 9, RtcOctober = 10, RtcNovember = 11, RtcDecember = 12
}
 Month name definitions (not used in driver - to be used by user appliciation) More...
enum  en_rtc_time_mode { RtcTimerOneshot = 0u, RtcTimerPeriod = 1u }
 Real Time Clock timer mode selection. More...
enum  en_rtc_div_ratio {
  RtcDivRatio1 = 0x00u, RtcDivRatio2 = 0x01u, RtcDivRatio4 = 0x02u, RtcDivRatio8 = 0x03u,
  RtcDivRatio16 = 0x04u, RtcDivRatio32 = 0x05u, RtcDivRatio64 = 0x06u, RtcDivRatio128 = 0x07u,
  RtcDivRatio256 = 0x08u, RtcDivRatio512 = 0x09u, RtcDivRatio1024 = 0x0Au, RtcDivRatio2048 = 0x0Bu,
  RtcDivRatio4096 = 0x0Cu, RtcDivRatio8192 = 0x0Du, RtcDivRatio16384 = 0x0Eu, RtcDivRatio32768 = 0x0Fu
}
 Rtc Divider Ratio Setting. More...
enum  en_rtc_status {
  RtcRewriteError = 0u, RtcAlarmElementMatch = 1u, RtcTimerUnderFlow = 2u, RtcOneHourFlag = 3u,
  RtcOneMiniteFlag = 4u, RtcOneSecondFlag = 5u, RtcHalfSecondFlag = 6u, RtcRunStatus = 7u,
  RtcTimerStatus = 8u
}
 Real Time Clock status types. More...

Functions

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.
void Rtc_Reset (void)
 Reset 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.
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_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.
en_result_t Rtc_SetDayOfWeek (stc_rtc_time_t *pstcRtcTime)
 Set Day of the Week.

Detailed Description

Headerfile for RTC functions

History:

  • 2013-02-21 Edison Zhang First verison

Definition in file rtc.h.