|
RTClib
|
RTC based on the DS3231 chip connected via I2C and the Wire library. More...
#include <RTClib.h>
Public Member Functions | |
| bool | begin (TwoWire *wireInstance=&Wire) |
| Start I2C for the DS3231 and test succesful connection. More... | |
| void | adjust (const DateTime &dt) |
| Set the date and flip the Oscillator Stop Flag. More... | |
| bool | lostPower (void) |
| Check the status register Oscillator Stop Flag to see if the DS3231 stopped due to power loss. More... | |
| DateTime | now () |
| Get the current date/time. More... | |
| Ds3231SqwPinMode | readSqwPinMode () |
| Read the SQW pin mode. More... | |
| void | writeSqwPinMode (Ds3231SqwPinMode mode) |
| Set the SQW pin mode. More... | |
| bool | setAlarm1 (const DateTime &dt, Ds3231Alarm1Mode alarm_mode) |
| Set alarm 1 for DS3231. More... | |
| bool | setAlarm2 (const DateTime &dt, Ds3231Alarm2Mode alarm_mode) |
| Set alarm 2 for DS3231. More... | |
| DateTime | getAlarm1 () |
| Get the date/time value of Alarm1. More... | |
| DateTime | getAlarm2 () |
| Get the date/time value of Alarm2. More... | |
| Ds3231Alarm1Mode | getAlarm1Mode () |
| Get the mode for Alarm1. More... | |
| Ds3231Alarm2Mode | getAlarm2Mode () |
| Get the mode for Alarm2. More... | |
| void | disableAlarm (uint8_t alarm_num) |
| Disable alarm. More... | |
| void | clearAlarm (uint8_t alarm_num) |
| Clear status of alarm. More... | |
| bool | alarmFired (uint8_t alarm_num) |
| Get status of alarm. More... | |
| void | enable32K (void) |
| Enable 32KHz Output. More... | |
| void | disable32K (void) |
| Disable 32KHz Output. | |
| bool | isEnabled32K (void) |
| Get status of 32KHz Output. More... | |
| float | getTemperature () |
| Get the current temperature from the DS3231's temperature sensor. More... | |
Static Public Member Functions | |
| static uint8_t | dowToDS3231 (uint8_t d) |
| Convert the day of the week to a representation suitable for storing in the DS3231: from 1 (Monday) to 7 (Sunday). More... | |
RTC based on the DS3231 chip connected via I2C and the Wire library.
| bool RTC_DS3231::begin | ( | TwoWire * | wireInstance = &Wire | ) |
Start I2C for the DS3231 and test succesful connection.
| wireInstance | pointer to the I2C bus |
| void RTC_DS3231::adjust | ( | const DateTime & | dt | ) |
Set the date and flip the Oscillator Stop Flag.
| dt | DateTime object containing the date/time to set |
| bool RTC_DS3231::lostPower | ( | void | ) |
Check the status register Oscillator Stop Flag to see if the DS3231 stopped due to power loss.
| DateTime RTC_DS3231::now | ( | ) |
Get the current date/time.
| Ds3231SqwPinMode RTC_DS3231::readSqwPinMode | ( | ) |
Read the SQW pin mode.
| void RTC_DS3231::writeSqwPinMode | ( | Ds3231SqwPinMode | mode | ) |
Set the SQW pin mode.
| mode | Desired mode, see Ds3231SqwPinMode enum |
| bool RTC_DS3231::setAlarm1 | ( | const DateTime & | dt, |
| Ds3231Alarm1Mode | alarm_mode | ||
| ) |
Set alarm 1 for DS3231.
| dt | DateTime object |
| alarm_mode | Desired mode, see Ds3231Alarm1Mode enum |
| bool RTC_DS3231::setAlarm2 | ( | const DateTime & | dt, |
| Ds3231Alarm2Mode | alarm_mode | ||
| ) |
Set alarm 2 for DS3231.
| dt | DateTime object |
| alarm_mode | Desired mode, see Ds3231Alarm2Mode enum |
| DateTime RTC_DS3231::getAlarm1 | ( | ) |
Get the date/time value of Alarm1.
| DateTime RTC_DS3231::getAlarm2 | ( | ) |
Get the date/time value of Alarm2.
| Ds3231Alarm1Mode RTC_DS3231::getAlarm1Mode | ( | ) |
Get the mode for Alarm1.
| Ds3231Alarm2Mode RTC_DS3231::getAlarm2Mode | ( | ) |
Get the mode for Alarm2.
| void RTC_DS3231::disableAlarm | ( | uint8_t | alarm_num | ) |
Disable alarm.
| alarm_num | Alarm number to disable |
| void RTC_DS3231::clearAlarm | ( | uint8_t | alarm_num | ) |
Clear status of alarm.
| alarm_num | Alarm number to clear |
| bool RTC_DS3231::alarmFired | ( | uint8_t | alarm_num | ) |
Get status of alarm.
| alarm_num | Alarm number to check status of |
| void RTC_DS3231::enable32K | ( | void | ) |
Enable 32KHz Output.
The 32kHz output is enabled by default. It requires an external pull-up resistor to function correctly
| bool RTC_DS3231::isEnabled32K | ( | void | ) |
Get status of 32KHz Output.
| float RTC_DS3231::getTemperature | ( | ) |
Get the current temperature from the DS3231's temperature sensor.
|
inlinestatic |
Convert the day of the week to a representation suitable for storing in the DS3231: from 1 (Monday) to 7 (Sunday).
| d | Day of the week as represented by the library: from 0 (Sunday) to 6 (Saturday). |
1.8.13