77 lines
1.8 KiB
C
77 lines
1.8 KiB
C
#ifndef __RTC_H
|
|
#define __RTC_H
|
|
|
|
#include "sys.h"
|
|
#include "general_type.h"
|
|
#include "stm32l1xx.h"
|
|
#include "stm32l1xx_gpio.h"
|
|
#include "stm32l1xx_rcc.h"
|
|
#include "stm32l1xx_exti.h"
|
|
#include "stm32l1xx_rtc.h"
|
|
#include "stm32l1xx_pwr.h"
|
|
#include "bsp.h"
|
|
|
|
//#define WKUP_KD PCin(13) //PC13 检测是否外部WK_UP按键按下
|
|
#define WKUP_KD GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_13)
|
|
void RTC_NVIC_CONFIG(void);
|
|
void RTC_Time_Init(void);
|
|
void Sleep_Mode(void);
|
|
void RtcWakeUpConfig(u32 temp);
|
|
void MYRTC_Init(void);
|
|
u8 Check_WKUP(void);
|
|
void SetRTC(int set_year,int set_mon,int set_day,int set_hour,int set_min ,int set_sec) ;
|
|
void Set_GNSSTIME_Rtc(void);
|
|
void GetRTC(char *hhmmss,char *yymmdd);
|
|
u32 RTC_GetSeconds(void);
|
|
void RTC_AlarmAConfig(u32 seconds);//设置闹钟时间
|
|
void RTC_AlarmBConfig(int set_year,int set_mon,int set_day,int set_hour,int set_min ,int set_sec);
|
|
u8 Is_Leap_Year(u16 year);
|
|
u8 Key_Scan(void);
|
|
void rtc_std_init(void);
|
|
void RtcWakeUppin(void);
|
|
void Measure_Ap_E(void);
|
|
void Measure_Ap_S(void);
|
|
typedef struct MYITStatu
|
|
{
|
|
unsigned char AlarmA_ITStatus :1;
|
|
unsigned char AlarmB_ITStatus :1;
|
|
unsigned char WUT_ITStatus :1;
|
|
unsigned char WKUP1_ITStatus :1;
|
|
unsigned char WKUP_POWBUTTON :1;
|
|
unsigned char WKUP_MEA_WIFI :1;
|
|
unsigned char WKUP_Test_WIFI :1;
|
|
}MYITStatus_Struct; //定义中断的结构体
|
|
|
|
typedef enum
|
|
{
|
|
AlarmA_ITHP=1,
|
|
AlarmB_ITHP=2,
|
|
WUT_ITHP=3,
|
|
WKUP1_ITHP=4,
|
|
Power_ON=0,
|
|
|
|
}STB_ITStatus;
|
|
|
|
|
|
|
|
typedef enum
|
|
{
|
|
KEY_CHECK = 0,
|
|
KEY_COMFIRM = 1,
|
|
KEY_RELEASE = 2,
|
|
KEY_SHORT=3,
|
|
KEY_LONG=4,
|
|
}KEY_STATE; //按键状态
|
|
|
|
typedef enum
|
|
{
|
|
NULL_KEY = 0,
|
|
SHORT_KEY =1,
|
|
LONG_KEY =2,
|
|
}KEY_TYPE;//按键值
|
|
|
|
extern MYITStatus_Struct MYITStatus1;//中断的状态显示
|
|
extern u8 key_time;
|
|
STB_ITStatus Get_Wkup_MYITstatus(void);
|
|
#endif
|