stm32_ota/SYSTEM/RTC/rtc.h

70 lines
2.4 KiB
C
Raw Permalink Normal View History

2023-12-15 06:28:06 +00:00
#ifndef __RTC_H
#define __RTC_H
#include "stm32f10x.h"
#include "stm32f10x_it.h"
#include "syslib.h"
/*****************************************
*<EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************/
typedef struct //2017-09-21 14:40:35
{ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
vu8 w_year[4] ; //"2017"
vu8 dash1 ; //"-"
vu8 w_month[2] ; //"09"
vu8 dash2 ; //"-"
vu8 w_date[2] ; //<2F><>21<32><31>
vu8 spacing ; //" "
vu8 hour[2] ; //"14"
vu8 colon1 ; //":"
vu8 min[2] ; //"40"
vu8 colon2 ; //":"
vu8 sec[2] ; //"35"
//vu8 week ;
}Calendar_s ; //Calendar_s<5F><EFBFBD><EFBFBD><E5A3AC>¼ʵʱʱ<CAB1><CAB1>
#define CALENDAR_LEN sizeof(Calendar_s) //Calendar_s<5F><EFBFBD><E1B9B9><EFBFBD>ֽڳ<D6BD><DAB3><EFBFBD>
typedef union uBytes19
{
Calendar_s sCalendar ;
uint8_t bytes[CALENDAR_LEN] ;
}Calendar_u ; //Calendar_u<5F><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5A3AC>¼ʵʱʱ<CAB1><CAB1>
typedef void (*RTCFP)(void) ; //<2F><><EFBFBD><EFBFBD><E5BAAF>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD>
/****************************************************************************/
/*****************************************
*<EFBFBD><EFBFBD><EFBFBD>ⲿʹ<EFBFBD>õij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************/
extern Calendar_u uCalendar ;
/********************************************************************************
*<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>ʹ<EFBFBD>õĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*********************************************************************************/
void RTC_IRQHandler(void) ; //RTC<54>жϴ<D0B6><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8_t CheckLeepYear(uint16_t year) ; //ƽ<><C6BD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
uint8_t RTC_Get_Week(uint16_t year, uint8_t month, uint8_t day) ; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
void Rtc_Hook(uint16_t rtcIt) ; //RTC<54>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD>
void Rtc_Sec_Callback(void) ; //RTC <20><><EFBFBD>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD>
/********************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿں<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*********************************************************************************/
extern RTCFP Rtc_RegHookCallback(uint16_t rtcIt, RTCFP pCallback) ; //RTC<54>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><E1BAAF>
extern RunResult RTC_Init(IntPriority_e ePriority) ; //<2F><>ʼ<EFBFBD><CABC>RTC
extern RunResult RTC_Get(Calendar_u *getCalendar) ; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
extern RunResult RTC_Set(Calendar_u *setCalendar); //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
extern RunResult RTC_Alarm_Set(Calendar_u *setCalendar) ; //<2F><><EFBFBD><EFBFBD>RTC<54><43><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
#endif