📄 rtc.h
字号:
/*-----------------------------------------------------------------------------
@@
@@ Copyright (c) 2000 Sharp Corporation All rights reserved.
@@
@@ (Summary) : LH79531 Real Time Clock Device Driver Header File
@@
@@ (Comment) : Real Time Clock Header File
@@
@@ (Author) : Teo Li Li
@@
@@ (History) : 20/11/2000 Teo Li Li Version 1.0
@@ 16/02/2001 Leow Yee Ling Version 1.2
@@
@@ (RCS ID) :
@@
-----------------------------------------------------------------------------*/
#ifndef APD_RTC_H
#define APD_RTC_H
/*+include files*************************************************************/
/* */
/* */
/**************************************************************************-*/
#include "type_def.h"
#include "dev_def.h"
#include "rtc_def.h"
/*+Public Macro definitions**************************************************/
/* */
/* */
/**************************************************************************-*/
/*+Public Type definitions***************************************************/
/* */
/* */
/**************************************************************************-*/
typedef APD_UCHAR APD_RTC_CENTURY, APD_RTC_YEAR, APD_RTC_MONTH, APD_RTC_DAY, APD_RTC_WEEK;
typedef APD_UCHAR APD_RTC_HOUR, APD_RTC_MINUTE, APD_RTC_SECOND;
/*-----------------------------------------------------------------------------
@@ {Name} : APD_RTC_CLK_FORMAT
@@
@@ {Summary} : Denotes whether the 12 hour clock is AM or PM or 24hr format
@@
@@ {Desc} : Clock format definitions.
@@
@@ {End} :
-----------------------------------------------------------------------------*/
typedef enum {
APD_RTC_NULL, /* 24HR format */
APD_RTC_AM, /* AM indication */
APD_RTC_PM /* PM indication */
} APD_RTC_CLK_FORMAT;
/*-----------------------------------------------------------------------------
@@ {Name} : APD_RTC_CALENDAR_TYPE
@@
@@ {Summary} : Describe the format for the Calendar
@@
@@ {Desc} : Data of century, year, month, day and week setting
@@ century : 0 denotes 20th century, 1 denotes 21st century
@@ year : 00 to 99
@@ month : 1 to 12
@@ day : 1 to 31
@@ week : 0 to 6 where 0 = sunday
@@
@@ {End} :
-----------------------------------------------------------------------------*/
typedef struct
{
APD_RTC_CENTURY century; /* century */
APD_RTC_YEAR year; /* year */
APD_RTC_MONTH month; /* month */
APD_RTC_DAY day; /* day */
APD_RTC_WEEK week; /* week */
} APD_RTC_CALENDAR_TYPE;
/*-----------------------------------------------------------------------------
@@ {Name} : APD_RTC_TIME_TYPE
@@
@@ {Summary} : Describes the format for the 12 hour clock or 24 hour clock
@@
@@ {Desc} : Data of hour, minute, second and format setting.
@@ hour : 0 to 11 (12hr) or 23 (24hr)
@@ minute : 0 to 59
@@ second : 0 to 59
@@ format : AM or PM or NULL
@@
@@ {End} :
-----------------------------------------------------------------------------*/
typedef struct
{
APD_RTC_HOUR hour; /* hour */
APD_RTC_MINUTE minute; /* minute */
APD_RTC_SECOND second; /* second */
APD_RTC_CLK_FORMAT format; /* format */
} APD_RTC_TIME_TYPE;
/*-----------------------------------------------------------------------------
@@ {Name} : APD_RTC_IRQF_FREQ_TYPE
@@
@@ {Summary} : Denote frequency selected for the IRQF output
@@
@@ {Desc} : Use to set the frequency for the IRQF output
@@
@@ {End} :
-----------------------------------------------------------------------------*/
typedef enum {
APD_RTC_NO_PULSE = 0x00, /* No pulse */
APD_RTC_1MIN = 0x08, /* period of IRQF = 1 min */
APD_RTC_1SEC = 0x10, /* period of IRQF = 1 sec */
APD_RTC_1D16SEC = 0x18 /* period of IRQF = 1/16 sec */
} APD_RTC_IRQF_FREQ_TYPE;
#ifdef APD_RTC_C
/*-------------------------- Local context - START -------------------------*/
/*+include files*************************************************************/
/* */
/* */
/**************************************************************************-*/
#define VISIBLE /* Mark as LOCAL context */
/*+Local Type definitions****************************************************/
/* */
/* */
/**************************************************************************-*/
/*+Local Macro definitions***************************************************/
/* */
/* */
/**************************************************************************-*/
/*+Local function prototypes*************************************************/
/* */
/* Name Type Abstract */
/* ---- ---- -------- */
/* */
/**************************************************************************-*/
/*+Local data declarations***************************************************/
/* */
/* Name Description */
/* ---- ----------- */
/**************************************************************************-*/
/*-------------------------- Local context - END ---------------------------*/
#else
#define VISIBLE extern /* Mark as GLOBAL context */
#endif
/*------------------------- Global context - START -------------------------*/
/*+Public data declarations**************************************************/
/* */
/* Name Description */
/* ---- ----------- */
/**************************************************************************-*/
/*+Public function prototypes************************************************/
/* */
/* Name Type Abstract */
/* ---- ---- -------- */
/* */
/**************************************************************************-*/
VISIBLE APD_VOID apd_RTCSetCalendar(APD_RTC_CALENDAR_TYPE);
VISIBLE APD_RTC_CALENDAR_TYPE apd_RTCGetCalendar(APD_VOID);
VISIBLE APD_VOID apd_RTCSetTime(APD_RTC_TIME_TYPE);
VISIBLE APD_RTC_TIME_TYPE apd_RTCGetTime(APD_RTC_CLK_FORMAT);
VISIBLE APD_VOID apd_RTCSetAlarm(APD_RTC_TIME_TYPE);
VISIBLE APD_RTC_TIME_TYPE apd_RTCGetAlarm(APD_RTC_CLK_FORMAT);
VISIBLE APD_VOID apd_RTCEnableClkInput(APD_VOID);
VISIBLE APD_VOID apd_RTCDisableClkInput(APD_VOID);
VISIBLE APD_VOID apd_RTCSelectCrystalClk(APD_VOID);
VISIBLE APD_VOID apd_RTCSelectExtClk(APD_VOID);
VISIBLE APD_VOID apd_RTCEnableAlarm(APD_VOID);
VISIBLE APD_VOID apd_RTCDisableAlarm(APD_VOID);
VISIBLE APD_VOID apd_RTCEnterModifyMode(APD_VOID);
VISIBLE APD_VOID apd_RTCExitModifyMode(APD_VOID);
VISIBLE APD_VOID apd_RTCEnterHoldMode(APD_VOID);
VISIBLE APD_VOID apd_RTCExitHoldMode(APD_VOID);
VISIBLE APD_VOID apd_RTCEnterAdjMode(APD_VOID);
VISIBLE APD_BOOLEAN apd_RTCIsAlarmOn(APD_VOID);
VISIBLE APD_BOOLEAN apd_RTCIsAlarmSet(APD_VOID);
VISIBLE APD_BOOLEAN apd_RTCIsAlarmSet(APD_VOID);
VISIBLE APD_VOID apd_RTCInit(APD_VOID);
/*-------------------------- Global context - END --------------------------*/
#undef VISIBLE
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -