📄 rtc.h
字号:
/****************************************Copyright (c)****************************************************
** Guangzhou ZHIYUAN electronics Co.,LTD.
**
** http://www.embedtools.com
**
**--------------File Info---------------------------------------------------------------------------------
** File name: RTC.h
** Last Date:
** Last Version: V1.0
** Descriptions: RTC驱动
**
**--------------------------------------------------------------------------------------------------------
** Created by: Liu Weifeng
** Created date: 2007-11-05
** Version: V1.0
** Descriptions:
**
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
*********************************************************************************************************/
#ifndef _RTC_H_
#define _RTC_H_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*********************************************************************************************************
RTC 相关索引
*********************************************************************************************************/
#define RTC0 0
#define RTC0_IRQ_CHN 13
/*********************************************************************************************************
RTC 模式配置命令
*********************************************************************************************************/
#define SET_TIME 0 /* 设置时间值宏定义 */
#define SET_ALARM 1 /* 报警中断宏定义 */
#define SET_SECINT 2 /* 秒中断宏定义 */
#define SET_MININT 3 /* 分钟中断宏定义 */
#define SET_HOURINT 4 /* 小时中断宏定义 */
#define SET_DOMINT 5 /* 日期(月)中断宏定义 */
#define SET_DOWINT 6 /* 星期中断宏定义 */
#define SET_MONINT 7 /* 月中断宏定义 */
#define SET_YEARINT 8 /* 年中断宏定义 */
/*********************************************************************************************************
RTC 读时间命令
*********************************************************************************************************/
#define READ_TIME 0 /* 读取当前时间值宏定义 */
#define READ_ALARM 1 /* 读取报警时间值宏定义 */
/*********************************************************************************************************
RTC 时间结构体
*********************************************************************************************************/
typedef struct
{
uint16 Year; /* 当前年 */
uint8 Month; /* 当前月 */
uint8 Day; /* 在月里面几号 */
uint8 Week; /* 星期几(0-6) */
uint8 Hour; /* 小时 */
uint8 Minute; /* 分钟 */
uint8 Second; /* 秒 */
} RTCTime;
/*********************************************************************************************************
**Function name: RTC初始化
**
**Descriptions: 初始化RTC,设定时间值
**
**input parameters: ID -〉子设备号,LPC只有一个PWM,ID=0
** arg -〉初始化参数,使用字符串指针传入
** Rsv -〉保留参数,输入0
** output parameters: None
**Returned value: OPERATE_SUCCESS-〉初始化成功
** OPERATE_FAIL -〉初始化失败
*********************************************************************************************************/
extern int32 RTCInit (uint32 ID,
char *Arg,
void *Rsv );
/*********************************************************************************************************
** Function name: RTCSetMode
**
** Descriptions: 设置PWM参数、模式
**
** input parameters: ID -〉子设备号
** CMD -〉命令参数
** arg -〉参数,使用字符串指针传入,
** output parameters: None
** Returned value: OPERATE_SUCCESS -〉初始化成功
** OPERATE_FAIL -〉初始化失败
*********************************************************************************************************/
extern int32 RTCSetMode (uint32 ID,
uint32 CMD,
char *arg);
/*********************************************************************************************************
** Function name: RTCRead
**
** Descriptions: 设置PWM参数、模式
**
** input parameters: ID -〉子设备号
** buf -〉输出时间值的指针地址
** CMD -〉命令参数,
** output parameters: None
** Returned value: OPERATE_SUCCESS -〉初始化成功
** OPERATE_FAIL -〉初始化失败
*********************************************************************************************************/
extern int32 RTCRead (uint32 ID,
RTCTime *time,
uint32 CMD,
void *Rsv);
/*********************************************************************************************************
** Function name: RTCISR
**
** Descriptions: 中断退出处理函数
**
** input parameters: 子设备号
** output parameters: None
** Returned value: 无
*********************************************************************************************************/
extern void RTCISR (uint32 ID);
__inline void RTC0_ISR (void)
{
/*
* 添加用户程序
*/
RTCISR (RTC0);
VICVectAddr = 0x00; /* 清除外部中断标志, */
/* 通知CPU中断结束 */
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _RTC_H_ */
/*********************************************************************************************************
END FILE
*********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -