59 lines
1.7 KiB
C
59 lines
1.7 KiB
C
|
#ifndef __RTC_H
|
|||
|
#define __RTC_H
|
|||
|
#include "stm32f10x.h"
|
|||
|
|
|||
|
/*********Ӧ<>ò<EFBFBD><C3B2>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>**************/
|
|||
|
#include "common.h"
|
|||
|
/*****************************************/
|
|||
|
|
|||
|
/****************************************************************************
|
|||
|
* RTC<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
****************************************************************************/
|
|||
|
#define RTC_IRQn_PreemptionPriority 15 //RTC<54><43>ռ<EFBFBD><D5BC><EFBFBD>ȼ<EFBFBD>
|
|||
|
#define RTC_IRQn_SubPriority 0 //RTC<54><43><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>,ʹ<><CAB9>FreeRTOSʱû<CAB1><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD>
|
|||
|
#define RTCAlarm_IRQn_PreemptionPriority 15 //RTCAlarm<72><6D>ռ<EFBFBD><D5BC><EFBFBD>ȼ<EFBFBD>
|
|||
|
#define RTCAlarm_IRQn_SubPriority 0 //RTCAlarm<72><6D><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>,ʹ<><CAB9>FreeRTOSʱû<CAB1><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><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 ;
|
|||
|
|
|||
|
typedef union uBytes19
|
|||
|
{
|
|||
|
Calendar calendar ;
|
|||
|
uint8_t bytes[19] ;
|
|||
|
}Calendar_u ;
|
|||
|
|
|||
|
extern Calendar_u uCalendar ;
|
|||
|
|
|||
|
extern RunResult RTC_Init(void) ; //<2F><>ʼ<EFBFBD><CABC>RTC,<2C><><EFBFBD><EFBFBD>0,ʧ<><CAA7>;1,<2C>ɹ<EFBFBD>;
|
|||
|
extern uint8_t 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(uint16_t syear, uint8_t smon, uint8_t sday, uint8_t hour, uint8_t min,uint8_t sec);
|
|||
|
|
|||
|
//extern void RTC_IRQHandler(void) ;
|
|||
|
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);
|
|||
|
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|