#ifndef DS3234_INC
#define DS3234_INC				1

#include	<msc_config.h>

//External Vars
extern time_t DS3234_secs;                          /* DS3234 time of day	*/
extern struct tm DS3234_tm;                             /* DS3234 time of day as struct tm*/

// REGISTERS FOR DS3234 RTC
typedef enum				
{					
    RTC_SEC = 0, RTC_MIN, RTC_HOUR, RTC_WDAY, RTC_MDAY, RTC_MON, RTC_YEAR,
    RTC_ALM1_SEC, RTC_ALM1_MIN, RTC_ALM1_HOUR, RTC_ALM1_DAY,
    RTC_ALM2_MIN, RTC_ALM2_HOUR, RTC_ALM2_DAY,
    RTC_CTRL, RTC_CTRLSTAT, RTC_XTAL_AGING,
    RTC_TEMP, RTC_TEMPL, RTC_TEMPCTRL,
    RTC_RSVD1, RTC_RSVD2, RTC_RSVD3, RTC_RSVD4,
    RTC_ADDR, RTC_DATA
} RTCRegs;


// DS3234 PROTOTYPES
int		DS3234_Init(void);
int 	DS3234_InitTime(void);
time_t	DS3234_GetTime(void);
void	DS3234_SetTime(time_t now);
int 	DS3234_RdSRAM(ushort ADDR, ushort DATBYTES, void *vp);
int 	DS3234_WrSRAM(ushort ADDR, ushort DATBYTES, void *vp);
float 	DS3234_GetTemp(void);
ushort	toBCD(ushort inw);
ushort 	fromBCD(ushort bcd);


#define WHOLESECS           0           // report time using CF2 RTC in whole secs resolution
#define FRACSECS            127         // report time using CF2 RTC in whole.frac secs resolution


#endif	
