85 lines
2.8 KiB
C
85 lines
2.8 KiB
C
|
/*********************************************************
|
|||
|
*Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd.
|
|||
|
*<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>: lib_rtc.h
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: WangMX
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: V1.00
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: 2017/07/14
|
|||
|
*<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: RTCģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
|||
|
*<EFBFBD><EFBFBD> ע: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HRSDK-GDB-ES8P508x V1.1
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧϰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾʹ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>κη<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ρ<EFBFBD>
|
|||
|
**********************************************************/
|
|||
|
#ifndef __LIBRTC_H__
|
|||
|
#define __LIBRTC_H__
|
|||
|
|
|||
|
#include "ES8P508x.h"
|
|||
|
#include "type.h"
|
|||
|
|
|||
|
/*RTCʱ<43><CAB1>Դѡ<D4B4><D1A1>*/
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
RTC_LOSC = 0x0, //<2F>ⲿ32768HZʱ<5A><CAB1> RTC<54><43>ȷ<EFBFBD><C8B7>ʱ
|
|||
|
RTC_LRC = 0x1, //<2F>ڲ<EFBFBD>LRCʱ<43><CAB1> RTC<54>Ǿ<EFBFBD>ȷ<EFBFBD><C8B7>ʱ
|
|||
|
RTC_PLCK_256 = 0x2, //PLCLK/256 RTC<54><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
RTC_PLCK = 0x3, //PCLK RTC<54><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}RTC_TYPE_CLKS;
|
|||
|
|
|||
|
/*RTCʱ<43><CAB1>12/24Сʱ<D0A1><CAB1>ѡ<EFBFBD><D1A1>*/
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
RTC_HOUR12 = 0x0, //12Сʱ<D0A1><CAB1>
|
|||
|
RTC_HOUR24 = 0x1, //24Сʱ<D0A1><CAB1>
|
|||
|
}RTC_TYPE_TIME;
|
|||
|
|
|||
|
/* RTC<54>ж<EFBFBD>Դѡ<D4B4><D1A1> */
|
|||
|
typedef enum {
|
|||
|
RTC_Interrupt_Source_Second = 0x001, // <20><><EFBFBD>ж<EFBFBD>
|
|||
|
RTC_Interrupt_Source_Minute = 0x002, // <20><><EFBFBD>ж<EFBFBD>
|
|||
|
RTC_Interrupt_Source_Hour = 0x004, // Сʱ<D0A1>ж<EFBFBD>
|
|||
|
RTC_Interrupt_Source_Day = 0x008, // <20><><EFBFBD>ж<EFBFBD>
|
|||
|
RTC_Interrupt_Source_Month = 0x010, // <20><><EFBFBD>ж<EFBFBD>
|
|||
|
RTC_Interrupt_Source_DayALE = 0x100, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
RTC_Interrupt_Source_WeekALE = 0x200, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
} RTC_Interrupt_Source;
|
|||
|
|
|||
|
|
|||
|
/********************* RTCģ<43>麯<EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *********************/
|
|||
|
void RTC_Init(RTC_TYPE_CLKS CLKx,RTC_TYPE_TIME HOURx);
|
|||
|
uint32_t RTC_ReadHourmode(void);
|
|||
|
uint32_t RTC_ReadSecond(void);
|
|||
|
uint32_t RTC_ReadMinute(void);
|
|||
|
uint32_t RTC_ReadHour(uint32_t *meridiem);
|
|||
|
uint32_t RTC_ReadDay(void);
|
|||
|
uint32_t RTC_ReadMonth(void);
|
|||
|
uint32_t RTC_ReadYear(void);
|
|||
|
uint32_t RTC_ReadWeek(void);
|
|||
|
|
|||
|
ErrorStatus RTC_WriteSecond(uint32_t second);
|
|||
|
ErrorStatus RTC_WriteMinute(uint32_t minute);
|
|||
|
ErrorStatus RTC_WriteHour(uint32_t hour, uint32_t meridiem);
|
|||
|
ErrorStatus RTC_WriteDay(uint32_t day);
|
|||
|
ErrorStatus RTC_WriteMonth(uint32_t month);
|
|||
|
ErrorStatus RTC_WriteYear(uint32_t year);
|
|||
|
ErrorStatus RTC_WriteWeek(uint32_t week);
|
|||
|
|
|||
|
uint32_t RTC_ReadWeekAlarmMinute(void);
|
|||
|
uint32_t RTC_ReadWeekAlarmHour(uint32_t *meridiem);
|
|||
|
uint32_t RTC_ReadWeekAlarmWeek(void);
|
|||
|
uint32_t RTC_ReadDayAlarmMinute(void);
|
|||
|
uint32_t RTC_ReadDayAlarmHour(uint32_t *meridiem);
|
|||
|
|
|||
|
ErrorStatus RTC_WriteWeekAlarmMinute(uint32_t minute);
|
|||
|
ErrorStatus RTC_WriteWeekAlarmHour(uint32_t hour, uint32_t meridiem);
|
|||
|
ErrorStatus RTC_WriteWeekAlarmWeek(uint32_t week);
|
|||
|
ErrorStatus RTC_WriteDayAlarmMinute(uint32_t minute);
|
|||
|
ErrorStatus RTC_WriteDayAlarmHour(uint32_t hour, uint32_t meridiem);
|
|||
|
|
|||
|
void RTC_InterruptEnable(RTC_Interrupt_Source src);
|
|||
|
void RTC_InterruptDisable(RTC_Interrupt_Source src);
|
|||
|
ITStatus RTC_GetITStatus(RTC_Interrupt_Source src);
|
|||
|
FlagStatus RTC_GetFlagStatus(RTC_Interrupt_Source src);
|
|||
|
void RTC_ClearITPendingBit(RTC_Interrupt_Source src);
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
/*************************END OF FILE**********************/
|