Skip to content

Commit

Permalink
dox
Browse files Browse the repository at this point in the history
  • Loading branch information
caternuson committed Oct 28, 2021
1 parent 237b0d4 commit 0d05d5b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/RTClib.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,18 @@ class TimeSpan {
/**************************************************************************/
class RTC_I2C {
protected:
/*!
@brief Convert a binary coded decimal value to binary. RTC stores
time/date values as BCD.
@param val BCD value
@return Binary value
*/
static uint8_t bcd2bin(uint8_t val) { return val - 6 * (val >> 4); }
/*!
@brief Convert a binary value to BCD format for the RTC registers
@param val Binary value
@return BCD value
*/
static uint8_t bin2bcd(uint8_t val) { return val + 6 * (val / 10); }
Adafruit_I2CDevice *i2c_dev = NULL; ///< Pointer to I2C bus interface
uint8_t read_register(uint8_t reg);
Expand Down Expand Up @@ -373,6 +384,12 @@ class RTC_DS3231 : RTC_I2C {
void disable32K(void);
bool isEnabled32K(void);
float getTemperature(); // in Celsius degree
/*!
@brief Convert the day of the week to a representation suitable for
storing in the DS3231: from 1 (Monday) to 7 (Sunday).
@param d Day of the week as represented by the library:
from 0 (Sunday) to 6 (Saturday).
*/
static uint8_t dowToDS3231(uint8_t d) { return d == 0 ? 7 : d; }
};

Expand Down

0 comments on commit 0d05d5b

Please sign in to comment.