j
Fork of ds3231 by
Diff: ds3231.h
- Revision:
- 8:c7484a65fcea
- Parent:
- 5:61dfe2690360
- Child:
- 9:e57201ee8921
--- a/ds3231.h Mon Dec 01 20:31:03 2014 +0000 +++ b/ds3231.h Fri Dec 05 21:11:26 2014 +0000 @@ -53,7 +53,6 @@ #include "mbed.h" -//7 bit I2C slave address and R/W bits #define DS3231_I2C_ADRS 0x68 #define I2C_WRITE 0 #define I2C_READ 1 @@ -81,7 +80,10 @@ #define OSF (1 << 7) -//enumerated registers +/** +* !!!!!TEST!!!!! +* enumerated registers +*/ typedef enum { SECONDS, @@ -106,7 +108,21 @@ }ds3231_regs_t; -//Time data +/** +* ds3231_time_t - Struct for containing time data. +* +* Members: +* +* - uint8_t seconds - Use decimal value. Member fx's convert to BCD +* +* - uint8_t minutes - Use decimal value. Member fx's convert to BCD +* +* - uint8_t hours - Use decimal value. Member fx's convert to BCD +* +* - bool am_pm - TRUE for PM, same logic as datasheet +* +* - bool mode - TRUE for 12 hour, same logic as datasheet +*/ typedef struct { uint8_t seconds; //Use decimal value. Member fx's convert to BCD @@ -117,7 +133,19 @@ }ds3231_time_t; -//Calendar data +/** +* ds3231_calendar_t - Struct for containing calendar data. +* +* Members: +* +* - uint8_t day - Use decimal value. Member fx's convert to BCD +* +* - uint8_t date - Use decimal value. Member fx's convert to BCD +* +* - uint8_t month - Use decimal value. Member fx's convert to BCD +* +* - uint8_t year - Use decimal value. Member fx's convert to BCD +*/ typedef struct { uint8_t day; //Use decimal value. Member fx's convert to BCD @@ -127,7 +155,35 @@ }ds3231_calendar_t; -//Alarm data +/** +* ds3231_alrm_t - Struct for containing alarm data. +* +* Members: +* +* - uint8_t seconds - Use decimal value. Member fx's convert to BCD +* +* - uint8_t minutes - Use decimal value. Member fx's convert to BCD +* +* - uint8_t hours - Use decimal value. Member fx's convert to BCD +* +* - uint8_t day - Use decimal value. Member fx's convert to BCD +* +* - uint8_t date - Use decimal value. Member fx's convert to BCD +* +* - bool am1 - Flag for setting alarm rate +* +* - bool am2 - Flag for setting alarm rate +* +* - bool am3 - Flag for setting alarm rate +* +* - bool am4 - Flag for setting alarm rate +* +* - bool am_pm - TRUE for PM, same logic as datasheet +* +* - bool mode - TRUE for 12 hour, same logic as datasheet +* +* - bool dy_dt - TRUE for Day, same logic as datasheet +*/ typedef struct { //Seconds and am1 not used for alarm2 @@ -146,6 +202,16 @@ }ds3231_alrm_t; +/** +* ds3231_cntl_stat_t - Struct for containing control and status +* register data. +* +* Members: +* +* - uint8_t control - Binary data for read/write of control register +* +* - uint8_t status - Binary data for read/write of status register +*/ typedef struct { uint8_t control; //binary data