Skip to content

Commit b9bcf7a

Browse files
committed
Add GenericRTC.h back (symlink issue.)
1 parent c6adb3e commit b9bcf7a

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=DS3232RTC
2-
version=3.1.0
2+
version=3.1.1
33
author=Jack Christensen <jack.christensen@outlook.com>
44
maintainer=Jack Christensen <jack.christensen@outlook.com>
55
sentence=Arduino Library for Maxim Integrated DS3231 and DS3232 Real-Time Clocks.

src/GenericRTC.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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

0 commit comments

Comments
 (0)