20230731_XiaoFuZi_emb/ZheDaXiaoFuZi/Src/Usr/Bsp/McuBspRtc.h
Rjh913828050 a8560d741e 类型:重构
内容:重新整理项目文件分类
人员:任家豪
2023-10-08 16:10:23 +08:00

44 lines
1.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _MCU_BSP_RTC_H_
#define _MCU_BSP_RTC_H_
#include "stm32f1xx_hal.h"
typedef void (*BspRtcAlarmCallback) (void);
/* 定义时间格式 */
typedef struct {
unsigned char Hours;
unsigned char Minutes;
unsigned char Seconds;
unsigned char Month;
unsigned char Date;
unsigned short Year;
} MCU_BSP_CLOCK;
/* 定义设备唤醒周期 */
#define MCU_BSP_RTC_CLOCK_WAKEUP_PERIOD_30MIN 0
#define MCU_BSP_RTC_CLOCK_WAKEUP_PERIOD_1HOUR 1
#define MCU_BSP_RTC_CLOCK_WAKEUP_PERIOD_2HOUR 2
#define MCU_BSP_RTC_CLOCK_WAKEUP_PERIOD_3HOUR 3
#define MCU_BSP_RTC_CLOCK_WAKEUP_PERIOD_4HOUR 4
#define MCU_BSP_RTC_CLOCK_WAKEUP_PERIOD_6HOUR 6
#define MCU_BSP_RTC_CLOCK_WAKEUP_PERIOD_8HOUR 8
#define MCU_BSP_RTC_CLOCK_WAKEUP_PERIOD_12HOUR 12
#define MCU_BSP_RTC_CLOCK_WAKEUP_PERIOD_24HOUR 24
#define MCU_BSP_RTC_CLOCK_SOURCE_LSE // 表示RTC时钟使用外部低速晶振一般有则用
/* 初始化RTC */
int McuBspRtcInit(void);
/* 设置当前时间 */
int McuBspRtcSetTime(MCU_BSP_CLOCK *time);
/* 获取RTC同步标志位 */
int McuBspRtcGetSyncFlag(void);
/* 读取当前时间 */
int McuBspRtcGetTime(MCU_BSP_CLOCK *time);
/* 启动RTC闹钟中断 */
int McuBspRtcStartAlarm(unsigned char RtcPeriod, BspRtcAlarmCallback Callback);
void McuBspRtcEndAlarm(void);
#endif