DS3231 based on Adafruit RTClib
RTC_DS3231 Class Reference
RTC based on the DS3231 chip connected via I2C and the Wire library. More...
#include <RTClib.h>
Public Member Functions | |
| bool | begin (void) |
| Start I2C for the DS3231 and test succesful connection. | |
| void | adjust (const DateTime &dt) |
| Set the date and flip the Oscillator Stop Flag. | |
| bool | lostPower (void) |
| Check the status register Oscillator Stop Flag to see if the DS3231 stopped due to power loss. | |
| DateTime | now () |
| Get the current date/time. | |
| Ds3231SqwPinMode | readSqwPinMode () |
| Read the SQW pin mode. | |
| void | writeSqwPinMode (Ds3231SqwPinMode mode) |
| Set the SQW pin mode. | |
| float | getTemperature () |
| Get the current temperature from the DS3231's temperature sensor. | |
| uint8_t | read_i2c_register (uint8_t addr, uint8_t reg) |
| Read a uint8_t from an I2C register. | |
| void | write_i2c_register (uint8_t addr, uint8_t reg, uint8_t val) |
| Write a uint8_t to an I2C register. | |
Detailed Description
RTC based on the DS3231 chip connected via I2C and the Wire library.
Definition at line 271 of file RTClib.h.
Member Function Documentation
| void adjust | ( | const DateTime & | dt ) |
Set the date and flip the Oscillator Stop Flag.
- Parameters:
-
dt DateTime object containing the date/time to set
Definition at line 610 of file RTClib.cpp.
| bool begin | ( | void | ) |
Start I2C for the DS3231 and test succesful connection.
- Returns:
- True if Wire can find DS3231 or false otherwise.
Definition at line 583 of file RTClib.cpp.
| float getTemperature | ( | ) |
Get the current temperature from the DS3231's temperature sensor.
- Returns:
- Current temperature (float)
Definition at line 694 of file RTClib.cpp.
| bool lostPower | ( | void | ) |
Check the status register Oscillator Stop Flag to see if the DS3231 stopped due to power loss.
- Returns:
- True if the bit is set (oscillator stopped) or false if it is running
Definition at line 599 of file RTClib.cpp.
| DateTime now | ( | ) |
Get the current date/time.
- Returns:
- DateTime object with the current date/time
Definition at line 634 of file RTClib.cpp.
| uint8_t read_i2c_register | ( | uint8_t | addr, |
| uint8_t | reg | ||
| ) |
Read a uint8_t from an I2C register.
- Parameters:
-
addr I2C address reg Register address
- Returns:
- Register value
Definition at line 56 of file RTClib.cpp.
| Ds3231SqwPinMode readSqwPinMode | ( | ) |
Read the SQW pin mode.
- Returns:
- Pin mode, see Ds3231SqwPinMode enum
Definition at line 654 of file RTClib.cpp.
| void write_i2c_register | ( | uint8_t | addr, |
| uint8_t | reg, | ||
| uint8_t | val | ||
| ) |
Write a uint8_t to an I2C register.
- Parameters:
-
addr I2C address reg Register address val Value to write
Definition at line 77 of file RTClib.cpp.
| void writeSqwPinMode | ( | Ds3231SqwPinMode | mode ) |
Set the SQW pin mode.
- Parameters:
-
mode Desired mode, see Ds3231SqwPinMode enum
Definition at line 670 of file RTClib.cpp.
Generated on Wed Jul 13 2022 06:14:12 by
1.7.2