diff --git a/src/RTClib.h b/src/RTClib.h index 879bb3fa..f184458d 100644 --- a/src/RTClib.h +++ b/src/RTClib.h @@ -324,6 +324,13 @@ class TimeSpan { */ /**************************************************************************/ class RTC_I2C { +public: + /*! + @brief Check if I2C device is present + @return true if present, false otherwise + */ + bool isPresent(void) { return i2c_dev != NULL; }; + protected: /*! @brief Convert a binary coded decimal value to binary. RTC stores @@ -348,7 +355,7 @@ class RTC_I2C { @brief RTC based on the DS1307 chip connected via I2C and the Wire library */ /**************************************************************************/ -class RTC_DS1307 : RTC_I2C { +class RTC_DS1307 : public RTC_I2C { public: bool begin(TwoWire *wireInstance = &Wire); void adjust(const DateTime &dt); @@ -367,7 +374,7 @@ class RTC_DS1307 : RTC_I2C { @brief RTC based on the DS3231 chip connected via I2C and the Wire library */ /**************************************************************************/ -class RTC_DS3231 : RTC_I2C { +class RTC_DS3231 : public RTC_I2C { public: bool begin(TwoWire *wireInstance = &Wire); void adjust(const DateTime &dt); @@ -403,7 +410,7 @@ class RTC_DS3231 : RTC_I2C { @brief RTC based on the PCF8523 chip connected via I2C and the Wire library */ /**************************************************************************/ -class RTC_PCF8523 : RTC_I2C { +class RTC_PCF8523 : public RTC_I2C { public: bool begin(TwoWire *wireInstance = &Wire); void adjust(const DateTime &dt); @@ -430,7 +437,7 @@ class RTC_PCF8523 : RTC_I2C { @brief RTC based on the PCF8563 chip connected via I2C and the Wire library */ /**************************************************************************/ -class RTC_PCF8563 : RTC_I2C { +class RTC_PCF8563 : public RTC_I2C { public: bool begin(TwoWire *wireInstance = &Wire); bool lostPower(void);