File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 11name =DS3232RTC
2- version =3.1.0
2+ version =3.1.1
33author =Jack Christensen <jack.christensen@outlook.com>
44maintainer =Jack Christensen <jack.christensen@outlook.com>
55sentence =Arduino Library for Maxim Integrated DS3231 and DS3232 Real-Time Clocks.
Original file line number Diff line number Diff line change 1+ // Abtract base class for:
2+ // Arduino DS3232RTC Library https://github.com/JChristensen/DS3232RTC
3+ // and Arduino MCP79412RTC Library // https://github.com/JChristensen/MCP79412RTC
4+ // Copyright (C) 2025 by Jack Christensen and licensed under
5+ // GNU GPL v3.0, https://www.gnu.org/licenses/gpl.html
6+ //
7+ // Allows a sketch to work with either type of RTC, can be determined at run time.
8+
9+ #ifndef GENERIC_RTC_H_INCLUDED
10+ #define GENERIC_RTC_H_INCLUDED
11+
12+ #include < Arduino.h>
13+ #include < TimeLib.h> // https://github.com/PaulStoffregen/Time
14+ #include < Wire.h>
15+
16+ class GenericRTC
17+ {
18+ public:
19+ GenericRTC (TwoWire& tw=Wire) : wire(tw) {};
20+ virtual void begin () = 0;
21+ virtual time_t get () = 0;
22+ virtual uint8_t set (const time_t t) = 0;
23+ virtual uint8_t writeRTC (const uint8_t addr, const uint8_t * values, const uint8_t nBytes) = 0;
24+ virtual uint8_t writeRTC (const uint8_t addr, const uint8_t value) = 0;
25+ virtual uint8_t readRTC (const uint8_t addr, uint8_t * values, const uint8_t nBytes) = 0;
26+ virtual uint8_t readRTC (const uint8_t addr) = 0;
27+
28+ protected:
29+ TwoWire& wire; // reference to Wire, Wire1, etc.
30+ };
31+ #endif
You can’t perform that action at this time.
0 commit comments