/*--------------------------------------------------------------------------------------
*  @file     FM31256.h
*  @author   ZhangJing
*  @version  base on stm32f0x   
*  @date     2015.09.11
*  @brief    FM31256驱动
---------------------------------------------------------------------------------------*/
#ifndef __FM31256_H__
#define __FM31256_H__

#include "stdint.h"

#define Const_IIC_READ			1 //读
#define Const_IIC_WRITE			0 //写 
//ID x A1 A0 R/W 1表示读操作,0表示写操作

#define Const_RAM_ADDR 		0XA0    //存储器器件(从机ID=1010b)  
#define Const_REG_ADDR 		0XD0    //实时时钟和处理器(从机ID=1101b) 

#define Const_COMPANION 	0X0B    //外围电路控制 SNL - - WP1 WP0 VBC VTP1 VTP0
#define Const_WDCON 			0X0A    //看门狗控制
#define Const_WDFLAG 			0X09		//看门狗重启&标志
/*
#define Const_YEAR 				0X08	//YEARS
#define Const_MONTH 			0X07	//MONTH
#define Const_DATE 				0X06	//DATE
#define Const_WEEK 				0X05	//WEEK
#define Const_HOURS 			0X04	//HOURS
#define Const_MINUTES 		0X03	//MINUTES
#define Const_SECONDS 		0X02	//SECONDS*/

#define Const_YEAR 				0X06	//YEARS
#define Const_MONTH 			0X05	//MONTH
#define Const_DATE 				0X04	//DATE
#define Const_WEEK 				0X03	//WEEK
#define Const_HOURS 			0X02	//HOURS
#define Const_MINUTES 		0X01	//MINUTES
#define Const_SECONDS 		0X00	//SECONDS


#define Const_CONTROL 		0x0E	//校准/控制
#define Const_FLAGS 			0x0F	//标志/控制

#define MAX_31256RAM_ADDRESS 0x4000			//铁电最大地址
#define SYSPARMA31256_DATA_START_ADDR		0x0000		//系统参数存储的首地址
#define HISTORY31256_RECORDQTY_ADDR			0x0080		//历史数据现已存储条数 历史数据存储指针
#define HISTORY31256_DATA_START_ADDR		0x0084		//历史数据起始地址
//#define HISTORY31256_DATA_InputTotalDose		0x1000		//已输入总量存储地址，

void GetCurDateTimeFromRTC( void );
void SetDateTimeToRTC( void );
void InitRtc(void);
//uint8_t Write_Multi31256RAM( uint16_t uiAddr , uint8_t *ucDataBufPtr , uint16_t uiLen );
//uint8_t Read_Multi31256RAM( uint16_t uiAddr, uint8_t *ucDataBufPtr, uint16_t uiLen );

#endif
