#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