diff --git a/library.properties b/library.properties index 2221b21..1f8da4b 100644 --- a/library.properties +++ b/library.properties @@ -6,5 +6,5 @@ sentence=Arduino Library for Maxim Integrated DS3232 and DS3231 Real-Time Clocks paragraph=Copyright (C) 2017-2022 by Jack Christensen and licensed under GNU GPL v3.0. See README file for important information regarding compatibility with earlier versions. category=Timing url=https://github.com/JChristensen/DS3232RTC -architectures=avr +architectures=* depends=Time diff --git a/src/DS3232RTC.cpp b/src/DS3232RTC.cpp index 3328bda..de81fe4 100644 --- a/src/DS3232RTC.cpp +++ b/src/DS3232RTC.cpp @@ -6,35 +6,7 @@ // Arduino library for the Maxim Integrated DS3232 // and DS3231 Real-Time Clocks. -// define release-independent I2C functions -#if defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) -#include -#define i2cBegin TinyWireM.begin -#define i2cBeginTransmission TinyWireM.beginTransmission -#define i2cEndTransmission TinyWireM.endTransmission -#define i2cRequestFrom TinyWireM.requestFrom -#define i2cRead TinyWireM.receive -#define i2cWrite TinyWireM.send -#elif ARDUINO >= 100 -#include -#define i2cBegin Wire.begin -#define i2cBeginTransmission Wire.beginTransmission -#define i2cEndTransmission Wire.endTransmission -#define i2cRequestFrom Wire.requestFrom -#define i2cRead Wire.read -#define i2cWrite Wire.write -#else -#include -#define i2cBegin Wire.begin -#define i2cBeginTransmission Wire.beginTransmission -#define i2cEndTransmission Wire.endTransmission -#define i2cRequestFrom Wire.requestFrom -#define i2cRead Wire.receive -#define i2cWrite Wire.send -#endif - #include -#include // https://github.com/PaulStoffregen/Time uint8_t DS3232RTC::errCode; diff --git a/src/DS3232RTC.h b/src/DS3232RTC.h index 3e488fe..3e80d97 100644 --- a/src/DS3232RTC.h +++ b/src/DS3232RTC.h @@ -12,6 +12,33 @@ #include #include // https://github.com/PaulStoffregen/Time +// define release-independent I2C functions +#if defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) +#include +#define i2cBegin TinyWireM.begin +#define i2cBeginTransmission TinyWireM.beginTransmission +#define i2cEndTransmission TinyWireM.endTransmission +#define i2cRequestFrom TinyWireM.requestFrom +#define i2cRead TinyWireM.receive +#define i2cWrite TinyWireM.send +#elif ARDUINO >= 100 +#include +#define i2cBegin Wire.begin +#define i2cBeginTransmission Wire.beginTransmission +#define i2cEndTransmission Wire.endTransmission +#define i2cRequestFrom Wire.requestFrom +#define i2cRead Wire.read +#define i2cWrite Wire.write +#else +#include +#define i2cBegin Wire.begin +#define i2cBeginTransmission Wire.beginTransmission +#define i2cEndTransmission Wire.endTransmission +#define i2cRequestFrom Wire.requestFrom +#define i2cRead Wire.receive +#define i2cWrite Wire.send +#endif + #ifndef _BV #define _BV(bit) (1 << (bit)) #endif