⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtc.h

📁 hreadx实时嵌入式操作系统源代码,ARM移植. threadx是一个很好的多任务实时嵌入式操作系统
💻 H
字号:
/****************************************Copyright (c)****************************************************
**                            Guangzhou ZHIYUAN electronics Co.,LTD.
**                                      
**                                 http://www.embedtools.com
**
**--------------File Info---------------------------------------------------------------------------------
** File name:               rtc.c
** Last modified Date:      2007-12-20
** Last Version:            1.0.0
** Descriptions:            2440 RTC 管理库
**
**--------------------------------------------------------------------------------------------------------
** Created by:              Hanhui
** Created date:            2007-12-20
** Version:                 1.0.0
** Descriptions:            2440 RTC 管理库
**
**--------------------------------------------------------------------------------------------------------
** Modified by:             
** Modified date:           
** Version:                 
** Descriptions:            
**
*********************************************************************************************************/

#ifndef __RTC_H
#define __RTC_H

/*********************************************************************************************************
  时间闹钟相关宏
*********************************************************************************************************/

#define RTC_YEAR_ALRAM_EN_BITE      (1 << 5)                            /*  年闹铃使能                  */
#define RTC_MONTH_ALRAM_EN_BITE     (1 << 4)                            /*  月闹铃使能                  */
#define RTC_DATE_ALRAM_EN_BITE      (1 << 3)                            /*  日闹铃使能                  */
#define RTC_HOUR_ALRAM_EN_BITE      (1 << 2)                            /*  时闹铃使能                  */
#define RTC_MIN_ALRAM_EN_BITE       (1 << 1)                            /*  分闹铃使能                  */
#define RTC_SEC_ALRAM_EN_BITE       (1 << 0)                            /*  秒闹铃使能                  */

/*********************************************************************************************************
  时间结构体
*********************************************************************************************************/
typedef struct {

    unsigned short      usYear;                                         /*  年                          */
    unsigned char       ucMonth;                                        /*  月                          */
    unsigned char       ucDate;                                         /*  日                          */
    
    unsigned char       ucDay;                                          /*  星期                        */
    
    unsigned char       ucHour;                                         /*  小时                        */
    unsigned char       ucMinute;                                       /*  分钟                        */
    unsigned char       ucSecond;                                       /*  秒                          */

} RTC_TIME;

/*********************************************************************************************************
** Function name:           rtcInit
** Descriptions:            初始化 RTC 模块
** input parameters:        NONE
** output parameters:       NONE
** Returned value:          NONE
*********************************************************************************************************/
void  rtcInit(void);

/*********************************************************************************************************
** Function name:           rtcEnableAlarm
** Descriptions:            允许 RTC 模块闹钟唤醒功能
** input parameters:        NONE
** output parameters:       NONE
** Returned value:          NONE
*********************************************************************************************************/
void  rtcEnableAlarm(void);

/*********************************************************************************************************
** Function name:           rtcDisableAlarm
** Descriptions:            不允许 RTC 模块闹钟唤醒功能
** input parameters:        NONE
** output parameters:       NONE
** Returned value:          NONE
*********************************************************************************************************/
void  rtcDisableAlarm(void);

/*********************************************************************************************************
** Function name:           rtcSetAlarmEnBit
** Descriptions:            设置 RTC 模块闹钟唤醒有效位
** input parameters:        ucBits          有效位掩码
** output parameters:       NONE
** Returned value:          NONE
*********************************************************************************************************/
void  rtcSetAlarmEnBit(unsigned char  ucBits);

/*********************************************************************************************************
** Function name:           rtcSetAlarmFunc
** Descriptions:            设置闹铃时间到时, 执行的函数(在中断中执行)
** input parameters:        pfuncRtcAlarmFunc   闹铃到时执行的函数
** output parameters:       NONE
** Returned value:          NONE
*********************************************************************************************************/
void  rtcSetAlarmFunc(void  (*pfuncRtcAlarmFunc)(void));

/*********************************************************************************************************
** Function name:           rtcSetAlarmTime
** Descriptions:            设置闹钟唤醒时间
** input parameters:        prtctimeAlarm       闹铃时间
** output parameters:       NONE
** Returned value:          NONE
*********************************************************************************************************/
/*********************************************************************************************************
  此函数可以设置闹铃时间, 但不能使能相关的唤醒操作, 需要调用其他使能类的函数.
*********************************************************************************************************/
void  rtcSetAlarmTime(RTC_TIME  *prtctimeAlarm);

/*********************************************************************************************************
** Function name:           rtcGetAlarmTime
** Descriptions:            获取闹钟唤醒时间
** input parameters:        NONE
** output parameters:       prtctimeAlarm       闹铃时间
** Returned value:          NONE
*********************************************************************************************************/
void  rtcGetAlarmTime(RTC_TIME  *prtctimeAlarm);

/*********************************************************************************************************
** Function name:           rtcSetTime
** Descriptions:            设置 RTC 时间
** input parameters:        prtctimeNow       当前时间
** output parameters:       NONE
** Returned value:          NONE
*********************************************************************************************************/
void  rtcSetTime(RTC_TIME  *prtctimeNow);

/*********************************************************************************************************
** Function name:           rtcGetTime
** Descriptions:            获取 RTC 时间
** input parameters:        NONE
** output parameters:       prtctimeNow       当前时间
** Returned value:          NONE
*********************************************************************************************************/
void  rtcGetTime(RTC_TIME  *prtctimeNow);

#endif                                                                  /*  __RTC_H                     */
/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -