|
|
@ -16,66 +16,66 @@
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Define the position of the RTC buffer values
|
|
|
|
* Define the position of the RTC buffer values
|
|
|
|
**/
|
|
|
|
**/
|
|
|
|
#define DS1337_SEC 0
|
|
|
|
#define DS1337_SEC 0
|
|
|
|
#define DS1337_MIN 1
|
|
|
|
#define DS1337_MIN 1
|
|
|
|
#define DS1337_HR 2
|
|
|
|
#define DS1337_HR 2
|
|
|
|
#define DS1337_DOW 3
|
|
|
|
#define DS1337_DOW 3
|
|
|
|
#define DS1337_DATE 4
|
|
|
|
#define DS1337_DATE 4
|
|
|
|
#define DS1337_MTH 5
|
|
|
|
#define DS1337_MTH 5
|
|
|
|
#define DS1337_YR 6
|
|
|
|
#define DS1337_YR 6
|
|
|
|
#define DS1337_CNTY 7
|
|
|
|
#define DS1337_CNTY 7
|
|
|
|
|
|
|
|
|
|
|
|
// For use externally
|
|
|
|
// For use externally
|
|
|
|
#define RTC_SEC DS1337_SEC
|
|
|
|
#define RTC_SEC DS1337_SEC
|
|
|
|
#define RTC_MIN DS1337_MIN
|
|
|
|
#define RTC_MIN DS1337_MIN
|
|
|
|
#define RTC_HR DS1337_HR
|
|
|
|
#define RTC_HR DS1337_HR
|
|
|
|
#define RTC_DOW DS1337_DOW
|
|
|
|
#define RTC_DOW DS1337_DOW
|
|
|
|
#define RTC_DATE DS1337_DATE
|
|
|
|
#define RTC_DATE DS1337_DATE
|
|
|
|
#define RTC_MTH DS1337_MTH
|
|
|
|
#define RTC_MTH DS1337_MTH
|
|
|
|
#define RTC_YR DS1337_YR
|
|
|
|
#define RTC_YR DS1337_YR
|
|
|
|
#define RTC_CNTY DS1337_CNTY
|
|
|
|
#define RTC_CNTY DS1337_CNTY
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Define the DS1337 I2C addresses
|
|
|
|
* Define the DS1337 I2C addresses
|
|
|
|
**/
|
|
|
|
**/
|
|
|
|
#ifndef DS1337_WADDR
|
|
|
|
#ifndef DS1337_WADDR
|
|
|
|
#define DS1337_WADDR 0x68
|
|
|
|
#define DS1337_WADDR 0x68
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#define DS1337_RADDR DS1337_WADDR | 0x01
|
|
|
|
#define DS1337_RADDR DS1337_WADDR | 0x01
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Define registers and bit masks
|
|
|
|
* Define registers and bit masks
|
|
|
|
**/
|
|
|
|
**/
|
|
|
|
#define DS1337_LO_BCD B00001111
|
|
|
|
#define DS1337_LO_BCD B00001111
|
|
|
|
#define DS1337_HI_BCD B01110000
|
|
|
|
#define DS1337_HI_BCD B01110000
|
|
|
|
|
|
|
|
|
|
|
|
#define DS1337_HI_SEC B01110000
|
|
|
|
#define DS1337_HI_SEC B01110000
|
|
|
|
#define DS1337_HI_MIN B01110000
|
|
|
|
#define DS1337_HI_MIN B01110000
|
|
|
|
#define DS1337_HI_HR B00110000
|
|
|
|
#define DS1337_HI_HR B00110000
|
|
|
|
#define DS1337_LO_DOW B00000111
|
|
|
|
#define DS1337_LO_DOW B00000111
|
|
|
|
#define DS1337_HI_DATE B00110000
|
|
|
|
#define DS1337_HI_DATE B00110000
|
|
|
|
#define DS1337_HI_MTH B00010000
|
|
|
|
#define DS1337_HI_MTH B00010000
|
|
|
|
#define DS1337_LO_CNTY B10000000
|
|
|
|
#define DS1337_LO_CNTY B10000000
|
|
|
|
#define DS1337_HI_YR B11110000
|
|
|
|
#define DS1337_HI_YR B11110000
|
|
|
|
|
|
|
|
|
|
|
|
#define DS1337_ARLM1 0x07
|
|
|
|
#define DS1337_ARLM1 0x07
|
|
|
|
#define DS1337_ARLM1_LO_SEC B00001111
|
|
|
|
#define DS1337_ARLM1_LO_SEC B00001111
|
|
|
|
#define DS1337_ARLM1_HI_SEC B01110000
|
|
|
|
#define DS1337_ARLM1_HI_SEC B01110000
|
|
|
|
#define DS1337_ARLM1_LO_MIN B01110000
|
|
|
|
#define DS1337_ARLM1_LO_MIN B01110000
|
|
|
|
#define DS1337_ARLM1_HI_MIN B00001111
|
|
|
|
#define DS1337_ARLM1_HI_MIN B00001111
|
|
|
|
|
|
|
|
|
|
|
|
#define DS1337_SP 0x0E
|
|
|
|
#define DS1337_SP 0x0E
|
|
|
|
#define DS1337_SP_EOSC B10000000
|
|
|
|
#define DS1337_SP_EOSC B10000000
|
|
|
|
#define DS1337_SP_RS2 B00010000
|
|
|
|
#define DS1337_SP_RS2 B00010000
|
|
|
|
#define DS1337_SP_RS1 B00001000
|
|
|
|
#define DS1337_SP_RS1 B00001000
|
|
|
|
#define DS1337_SP_INTCN B00000100
|
|
|
|
#define DS1337_SP_INTCN B00000100
|
|
|
|
#define DS1337_SP_A2IE B00000010
|
|
|
|
#define DS1337_SP_A2IE B00000010
|
|
|
|
#define DS1337_SP_A1IE B00000001
|
|
|
|
#define DS1337_SP_A1IE B00000001
|
|
|
|
|
|
|
|
|
|
|
|
#define DS1337_STATUS 0x0F
|
|
|
|
#define DS1337_STATUS 0x0F
|
|
|
|
#define DS1337_STATUS_OSF B10000000
|
|
|
|
#define DS1337_STATUS_OSF B10000000
|
|
|
|
#define DS1337_STATUS_A2F B00000010
|
|
|
|
#define DS1337_STATUS_A2F B00000010
|
|
|
|
#define DS1337_STATUS_A1F B00000001
|
|
|
|
#define DS1337_STATUS_A1F B00000001
|
|
|
|
|
|
|
|
|
|
|
|
// Alarm registers and masks
|
|
|
|
// Alarm registers and masks
|
|
|
|
#define DS1337_ALARM1 0x07
|
|
|
|
#define DS1337_ALARM1 0x07
|
|
|
|