Skip to content

Commit

Permalink
Add a constructor to improve backwards compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
JChristensen committed Feb 21, 2022
1 parent 20d8dee commit 07dd8f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with thi

The 2.0.0 version of the library has some significant changes and is not completely backwards compatible with earlier versions. These changes provide a more consistent API and reduce the possibility of name collisions. While sketches using this library will likely require changes as a result, these should be mostly straightforward.

- The library no longer defines a `DS3232RTC` object, therefore each sketch needs to define one. Previous versions of the library defined a DS3232RTC object named `RTC`, only for AVR architectures. (Consider using a name other than `RTC` as this can cause a name collision on some architectures.)
- The constructor no longer has the capability to initialize the I2C bus, therefore, the sketch needs to call `DS3232RTC::begin()` in the `setup()` function or elsewhere as appropriate.
- The library no longer defines a `DS3232RTC` object, therefore each sketch needs to define one. (Previous versions of the library defined a DS3232RTC object named `RTC`, although only for AVR architecture. Consider using a name other than `RTC` as this can cause a name collision on some architectures.)
- The constructor no longer has the capability to initialize the I2C bus and no longer accepts an optional parameter. Therefore, the sketch needs to call `DS3232RTC::begin()` in the `setup()` function or elsewhere as appropriate.
- To reduce the possibility of name collisions, the enumerations as well as register addresses, etc. are now defined in the header file within the DS3232RTC class. Therefore, when using any of these names, it will be necessary to include the DS3232RTC scope, e.g. `myRTC.alarm(DS3232RTC::ALARM_1);`
- Also to reduce collisions, register address names and bit names have been prefixed with `DS32_` (see the header file.)
- The example sketches and documentation have been updated to reflect these changes.
Expand Down
1 change: 1 addition & 0 deletions src/DS3232RTC.h
Expand Up @@ -132,6 +132,7 @@ class DS3232RTC
DS32_DYDT {6}; // Day/Date flag bit in alarm Day/Date registers

DS3232RTC() {};
DS3232RTC(bool initI2C) { (void)initI2C; } // undocumented for backward compatibility
void begin();
static time_t get(); // static needed to work with setSyncProvider() in the Time library
uint8_t set(time_t t);
Expand Down

0 comments on commit 07dd8f0

Please sign in to comment.