Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
281 Kevin 1
#ifndef RTC_DS3231_H
2
#define	RTC_DS3231_H
3
 
4
#define DS3231_ADDRESS  0x68
5
 
6
#define DS3231_SECONDS  0x00
7
#define DS3231_MINUTES  0x01
8
#define DS3231_HOUR     0x02
9
#define DS3231_DAY      0x03
10
#define DS3231_DATE     0x04
11
#define DS3231_MONTH    0x05
12
#define DS3231_YEAR     0x06
13
 
14
#define DS3231_ALARM1_SECONDS   0x07
15
#define DS3231_ALARM1_MINUTES   0x08
16
#define DS3231_ALARM1_HOUR      0x09
17
#define DS3231_ALARM1_DAY_DATE  0x0A
18
 
19
#define DS3231_ALARM2_MINUTES   0x0B
20
#define DS3231_ALARM2_HOUR      0x0C
21
#define DS3231_ALARM2_DAY_DATE  0x0D
22
 
23
#define DS3231_CONTROL  0x0E
24
#define DS3231_STATUS   0x0F
25
 
26
#define DS3231_TIME_ONLY
27
 
28
typedef struct {
29
    uint8_t sec;
30
    uint8_t min;
31
    uint8_t hour;
32
    uint8_t h_mil;
33
    uint8_t h_am_pm;
34
#ifndef DS3231_TIME_ONLY
35
    uint8_t day;
36
    uint8_t date;
37
    uint8_t month;
38
    uint8_t year;
39
#endif
40
} DS3231_TIME;
41
 
42
void DS3231_Init(void);
43
 
44
uint8_t DS3231_Get_Status(void);
45
 
46
void DS3231_Set_Time(DS3231_TIME *time);
47
 
48
void DS3231_Get_Time(DS3231_TIME *time);
49
 
50
//void DS3231_Set_Alarm1(uint8_t sec, uint8_t min, uint8_t hour, uint8_t date, bit mil, bit am_pm, bit dt_dy);
51
//void DS3231_Set_Alarm2(uint8_t min, uint8_t hour, uint8_t date, bit mil, bit am_pm, bit dt_dy);
52
 
53
#endif
54