-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathRTC.h
28 lines (21 loc) · 830 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
//=============================================================================
// Header file for the RTC class. RTC handles a real-time clock.
#ifndef __RTC_H__
#define __RTC_H__
#include <Arduino.h>
class RTC
{
public:
RTC(void);
~RTC(void);
bool isPresent(void) { return present; }
bool getClock(byte *ptr);
bool setClock(byte *ptr);
private:
bool present;
void setRtcTime(byte second, byte minute, byte hour, byte dayOfWeek, byte dayOfMonth, byte month, byte year);
void readDS3231time(byte *second, byte *minute, byte *hour, byte *dayOfWeek, byte *dayOfMonth, byte *month, byte *year);
byte decToBcd(byte val);
byte bcdToDec(byte val);
};
#endif // __RTC_H__