From bc68e55aff9d385c99fb16864187fbeb6cd24a58 Mon Sep 17 00:00:00 2001 From: Dan Ellis Date: Tue, 10 Jan 2023 22:37:37 -0500 Subject: [PATCH] Whitespace changes to appease clang. --- src/RTC_DS3231.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++-- src/RTClib.h | 4 ++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/RTC_DS3231.cpp b/src/RTC_DS3231.cpp index c26ed82f..bce80b6b 100644 --- a/src/RTC_DS3231.cpp +++ b/src/RTC_DS3231.cpp @@ -125,7 +125,7 @@ float RTC_DS3231::getTemperature() { */ /**************************************************************************/ int8_t RTC_DS3231::getAging() { - return read_register(DS3231_AGING); + return read_register(DS3231_AGING); } /**************************************************************************/ @@ -135,9 +135,51 @@ int8_t RTC_DS3231::getAging() { */ /**************************************************************************/ void RTC_DS3231::setAging(int8_t val) { - write_register(DS3231_AGING, val); + write_register(DS3231_AGING, val); } +/**************************************************************************/ +/*! + @brief Get the current value of the control register + @return Control register bits (unsigned int8) +*/ +/**************************************************************************/ +uint8_t RTC_DS3231::getControlReg() { + return read_register(DS3231_CONTROL); +} + +/**************************************************************************/ +/*! + @brief Write new values to all bits of the control register + @param val New value for the 8 bit control register. +*/ +/**************************************************************************/ +void RTC_DS3231::setControlReg(uint8_t val) { + write_register(DS3231_CONTROL, val); +} + +/**************************************************************************/ +/*! + @brief Get the current value of the status register + @return Status register bits (unsigned int8) +*/ +/**************************************************************************/ +uint8_t RTC_DS3231::getStatusReg() { + return read_register(DS3231_STATUSREG); +} + +/**************************************************************************/ +/*! + @brief Write new values to all bits of the status register e.g., to + clear flags. + @param val New value for the 8 bit status register. +*/ +/**************************************************************************/ +void RTC_DS3231::setStatusReg(uint8_t val) { + write_register(DS3231_STATUSREG, val); +} + + /**************************************************************************/ /*! @brief Set alarm 1 for DS3231 diff --git a/src/RTClib.h b/src/RTClib.h index d571aa60..af66ddff 100644 --- a/src/RTClib.h +++ b/src/RTClib.h @@ -390,6 +390,10 @@ class RTC_DS3231 : RTC_I2C { float getTemperature(); // in Celsius degree int8_t getAging(); void setAging(int8_t val); + uint8_t getControlReg(); + void setControlReg(uint8_t val); + uint8_t getStatusReg(); + void setStatusReg(uint8_t val); /*! @brief Convert the day of the week to a representation suitable for storing in the DS3231: from 1 (Monday) to 7 (Sunday).