65 lines
2.1 KiB
C
65 lines
2.1 KiB
C
|
|
/*
|
|||
|
|
*********************************************************************************************************
|
|||
|
|
* IAR Development Kits
|
|||
|
|
* on the
|
|||
|
|
*
|
|||
|
|
* M451
|
|||
|
|
*
|
|||
|
|
* Filename : rtc_wakeup.h
|
|||
|
|
* Version : V1.00
|
|||
|
|
* Programmer(s) : Qian Xianghong
|
|||
|
|
*********************************************************************************************************
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#ifndef USER_RTC_WAKEUP_PRESENT
|
|||
|
|
#define USER_RTC_WAKEUP_PRESENT
|
|||
|
|
|
|||
|
|
#include "type.h"
|
|||
|
|
|
|||
|
|
#pragma pack(push, 1)
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ṹ<EFBFBD><E1B9B9>NuvotonоƬ<D0BE><C6AC><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD>
|
|||
|
|
typedef struct {
|
|||
|
|
uint32_t u32Year; /*!< Year value */
|
|||
|
|
uint32_t u32Month; /*!< Month value */
|
|||
|
|
uint32_t u32Day; /*!< Day value */
|
|||
|
|
uint32_t u32DayOfWeek; /*!< Day of week value */
|
|||
|
|
uint32_t u32Hour; /*!< Hour value */
|
|||
|
|
uint32_t u32Minute; /*!< Minute value */
|
|||
|
|
uint32_t u32Second; /*!< Second value */
|
|||
|
|
uint32_t u32TimeScale; /*!< 12-Hour, 24-Hour */
|
|||
|
|
uint32_t u32AmPm; /*!< Only Time Scale select 12-hr used */
|
|||
|
|
} S_RTC_TIME_DATA_T;
|
|||
|
|
|
|||
|
|
#define RTC_YEAR2000 2000 /*!< RTC Reference */
|
|||
|
|
|
|||
|
|
#define RTC_CLOCK_12 0 /*!< RTC 12 Hour */
|
|||
|
|
#define RTC_CLOCK_24 1 /*!< RTC 24 Hour */
|
|||
|
|
|
|||
|
|
#define RTC_SUNDAY ((uint32_t) 0x00000000) /*!< Day of week is sunday */
|
|||
|
|
|
|||
|
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ʱ<EFBFBD>䣺<EFBFBD><E4A3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽΪNuvotonоƬ<D0BE><C6AC>ʽ
|
|||
|
|
void RTC_GetDateAndTime(S_RTC_TIME_DATA_T *sRTC);
|
|||
|
|
|
|||
|
|
#pragma pack(pop)
|
|||
|
|
|
|||
|
|
// RTC<54><43>ʼʱ<CABC>䣺<EFBFBD>̶<EFBFBD>Ϊ2016-01-01 00:00:00
|
|||
|
|
#define INITIAL_YEAR 2016
|
|||
|
|
|
|||
|
|
// ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>INITIAL_YEAR<41><52><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GPS<50><53>λ<EFBFBD><CEBB>GPRS<52><53><EFBFBD>ӻ<EFBFBD>վ<EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ã<EFBFBD>
|
|||
|
|
extern volatile uint32_t RTC_offsetSeconds;
|
|||
|
|
|
|||
|
|
void Wakeup_Open();
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>ij<EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint16_t get_month_days(uint16_t year, uint8_t month);
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>꿪ʼ<EABFAA><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
uint32_t Calc_SecondsFromYear(uint16_t startYear, uint16_t year, uint8_t mon, uint8_t day, uint8_t hour, uint8_t min, uint8_t sec);
|
|||
|
|
// <20>趨<EFBFBD>´<EFBFBD><C2B4><EFBFBD><EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
|
void Wakeup_SetAlarm();
|
|||
|
|
void Wakeup_SetAlarm_B();
|
|||
|
|
// <20><><EFBFBD><EFBFBD>INITIAL_YEAR<41><52>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
void Wakeup_CalcUTCTime(uint32_t totalSeconds, S_RTC_TIME_DATA_T *pRTC);
|
|||
|
|
|
|||
|
|
#endif
|