-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrtc.h
50 lines (41 loc) · 763 Bytes
/
rtc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef _RTC_H_
#define _RTC_H_
#include "sys.h"
#define RTC_I2C_ADDR 0x68 << 1
enum {
RTC_SEC = 0,
RTC_MIN,
RTC_HOUR,
RTC_WDAY,
RTC_DATE,
RTC_MONTH,
RTC_YEAR,
RTC_ETM,
RTC_AGING = 0x10,
RTC_TEMP = 0x11
};
typedef struct {
uint8_t sec;
uint8_t min;
uint8_t hour;
uint8_t wday;
uint8_t date;
uint8_t month;
uint8_t year;
uint8_t etm;
uint8_t temp;
} RTC_type;
extern RTC_type rtc;
#define RTC_NOEDIT 0xFF
void rtcInit(void);
void rtcReadTime(void);
void rtcSaveTime(void);
void rtcSaveDate(void);
void rtcSavePPM(void);
void rtcNextEditParam(void);
void rtcChangeTime(int8_t diff);
uint16_t rtcYearDay(void);
uint8_t rtcDaysInMonth(void);
uint8_t rtcBinDecToDec(uint8_t num);
uint8_t rtcDecToBinDec(uint8_t num);
#endif /* _RTC_H_ */