Subversion Repositories Code-Repo

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef RTC_DS3231_H
#define RTC_DS3231_H

#define DS3231_ADDRESS  0x68

#define DS3231_SECONDS  0x00
#define DS3231_MINUTES  0x01
#define DS3231_HOUR     0x02
#define DS3231_DAY      0x03
#define DS3231_DATE     0x04
#define DS3231_MONTH    0x05
#define DS3231_YEAR     0x06

#define DS3231_ALARM1_SECONDS   0x07
#define DS3231_ALARM1_MINUTES   0x08
#define DS3231_ALARM1_HOUR      0x09
#define DS3231_ALARM1_DAY_DATE  0x0A

#define DS3231_ALARM2_MINUTES   0x0B
#define DS3231_ALARM2_HOUR      0x0C
#define DS3231_ALARM2_DAY_DATE  0x0D

#define DS3231_CONTROL  0x0E
#define DS3231_STATUS   0x0F

#define DS3231_TIME_ONLY

typedef struct {
    uint8_t sec;
    uint8_t min;
    uint8_t hour;
    uint8_t h_mil;
    uint8_t h_am_pm;
#ifndef DS3231_TIME_ONLY
    uint8_t day;
    uint8_t date;
    uint8_t month;
    uint8_t year;
#endif
} DS3231_TIME;

void DS3231_Init(void);

uint8_t DS3231_Get_Status(void);

void DS3231_Set_Time(DS3231_TIME *time);

void DS3231_Get_Time(DS3231_TIME *time);

//void DS3231_Set_Alarm1(uint8_t sec, uint8_t min, uint8_t hour, uint8_t date, bit mil, bit am_pm, bit dt_dy);
//void DS3231_Set_Alarm2(uint8_t min, uint8_t hour, uint8_t date, bit mil, bit am_pm, bit dt_dy);

#endif