河北水利局项目
This commit is contained in:
72
APP/rtc_ext.h
Normal file
72
APP/rtc_ext.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef _RTC_EXT_H_
|
||||
#define _RTC_EXT_H_
|
||||
|
||||
#include "Basedefine.h"
|
||||
#include "stm32f10x.h"
|
||||
#include "Rtc.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 sec;
|
||||
u8 min;
|
||||
u8 hour;
|
||||
|
||||
u8 day;
|
||||
u8 month;
|
||||
u8 year;
|
||||
|
||||
u8 week;
|
||||
}st_rtc_ext,*PLst_rtc_ext;
|
||||
|
||||
#define RTC_WRIT_ADDR 0x64
|
||||
#define RTC_READ_ADDR 0x65
|
||||
|
||||
#define RTC_REG_SEC 0x00
|
||||
#define RTC_REG_MIN 0x01
|
||||
#define RTC_REG_HOUR 0x02
|
||||
#define RTC_REG_WEEK 0x03
|
||||
#define RTC_REG_DAY 0x04
|
||||
#define RTC_REG_MONTH 0x05
|
||||
#define RTC_REG_YEAR 0x06
|
||||
#define RTC_REG_RAM 0x07
|
||||
#define RTC_REG_MIN_Alarm 0x08
|
||||
#define RTC_REG_WEEK_Alarm 0x09
|
||||
#define RTC_REG_DAY_Alarm 0x0A
|
||||
#define RTC_REG_COUNT0 0x0B
|
||||
#define RTC_REG_COUNT1 0x0C
|
||||
#define RTC_REG_EXT 0x0D
|
||||
#define RTC_REG_FLAG 0x0E
|
||||
#define RTC_REG_CTRL 0x0F
|
||||
|
||||
|
||||
#define RTC_SDA_PIN GPIO_Pin_9
|
||||
#define RTC_SDA_PIN_PORT GPIOB
|
||||
#define RTC_SDA_PIN_CLK RCC_APB2Periph_GPIOB
|
||||
|
||||
#define RTC_SCL_PIN GPIO_Pin_8
|
||||
#define RTC_SCL_PIN_PORT GPIOB
|
||||
#define RTC_SCL_PIN_CLK RCC_APB2Periph_GPIOB
|
||||
|
||||
|
||||
|
||||
#define RTC_SDA_HIGH() GPIO_SetBits(RTC_SDA_PIN_PORT, RTC_SDA_PIN)
|
||||
#define RTC_SDA_LOW() GPIO_ResetBits(RTC_SDA_PIN_PORT, RTC_SDA_PIN)
|
||||
|
||||
#define RTC_SCL_HIGH() GPIO_SetBits(RTC_SCL_PIN_PORT, RTC_SCL_PIN)
|
||||
#define RTC_SCL_LOW() GPIO_ResetBits(RTC_SCL_PIN_PORT, RTC_SCL_PIN)
|
||||
|
||||
#define RTC_GET_SDA() GPIO_ReadInputDataBit( RTC_SDA_PIN_PORT, RTC_SDA_PIN)
|
||||
|
||||
|
||||
|
||||
|
||||
void set_rtc_time(st_rtc_ext rtc_dat);
|
||||
void read_rtc_time(st_rtc_ext * rtc_dat);
|
||||
void read_rtc_stime(sTime *time_dat);
|
||||
void read_rtc_stime(sTime *time_dat);
|
||||
void RTC_test(void);
|
||||
void ExtRTC_Process_Task(void *ptr);
|
||||
void GetExternClockTime(st_rtc_ext * rtc_dat);
|
||||
void set_rtc_time(st_rtc_ext rtc_dat);
|
||||
u8* GetCurrentTime( void );
|
||||
#endif
|
||||
Reference in New Issue
Block a user