forked from solideus/OpenSprinkler-ESP8266-WIFI-4-Channels-Relay-Module-AC-DC-ESP-12F-Development-Board
-
Notifications
You must be signed in to change notification settings - Fork 0
/
I2CRTC.h
38 lines (29 loc) · 723 Bytes
/
I2CRTC.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
/*
* I2CRTC.h - library for common I2C RTCs
* This library is intended to be uses with Arduino Time.h library functions
*/
#ifndef I2CRTC_h
#define I2CRTC_h
#define DS1307_ADDR 0x68
#define MCP7940_ADDR 0x6F
#define PCF8563_ADDR 0x51
#include "TimeLib.h"
// library interface description
class I2CRTC
{
// user-accessible "public" interface
public:
I2CRTC();
static time_t get();
static void set(time_t t);
static void read(tmElements_t &tm);
static void write(tmElements_t &tm);
static bool detect();
static bool exists();
private:
static uint8_t dec2bcd(uint8_t num);
static uint8_t bcd2dec(uint8_t num);
static uint8_t addr;
};
extern I2CRTC RTC;
#endif