hal_rtc.h

来自「最新版IAR FOR ARM(EWARM)5.11中的代码例子」· C头文件 代码 · 共 81 行

H
81
字号
//-----------------------------------------------------------------------------
// HAL_RTC
//-----------------------------------------------------------------------------
#ifndef HAL_RTC_H
#define HAL_RTC_H

//-----------------------------------------------------------------------------
#include "hal_map.h"

//-----------------------------------------------------------------------------
typedef union
{
  struct {
    u8  SU:4;
    u8  ST:3;
    u8  EMPTY1:1;
    u8  MIU:4;
    u8  MIT:3;
    u8  EMPTY2:1;
    u8  HU:4;
    u8  HT:2;
    u16 EMPTY3:10;
  } item;
	struct {
		u32 TIME;
	} reg;
} t_rtc_time;

typedef union
{
  struct {
    u8 DU:4;
    u8 DT:2;
    u8 EMPTY1:2;
    u8 MU:4;
    u8 MT:1;
    u8 EMPTY2:3;
    u8 YU:4;
    u8 YT:4;
    u8 YM:4;
    u8 YH:4;
  } item;
	struct {
		u32 DATE;
	} reg;
} t_rtc_date;

//-----------------------------------------------------------------------------
// RTC->CONTROL
//-----------------------------------------------------------------------------
#define RTC_ALARM_IE      0x80000000
#define RTC_FORCE_YEARS   0x00000020
#define RTC_FORCE_MONTHS  0x00000010
#define RTC_FORCE_DAYS    0x00000008
#define RTC_FORCE_HOURS   0x00000004
#define RTC_FORCE_MINUTES 0x00000002
#define RTC_RORCE_SECONDS 0x00000001

//-----------------------------------------------------------------------------
// RTC->STATUS
//-----------------------------------------------------------------------------
#define RTC_ALARM_INT_FLAG 0x80000000

//-----------------------------------------------------------------------------
// FUNCTION PROTOTYPES
//-----------------------------------------------------------------------------
void       RTC_Init        (void);
t_rtc_time RTC_Read_Time   (void);
void       RTC_Set_Time    (t_rtc_time rtc_time);
t_rtc_date RTC_Read_Date   (void);
void       RTC_Set_Date    (t_rtc_date rtc_date);
void       RTC_Set_Alarm   (t_rtc_time rtc_time, t_rtc_date rtc_date, u32 flags);
u8         RTC_Check_Alarm (void);

//-----------------------------------------------------------------------------
//Structures
//-----------------------------------------------------------------------------
extern t_rtc_date rtc_date;
extern t_rtc_time rtc_time;
#endif

⌨️ 快捷键说明

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