RTClib
Classes | Macros | Enumerations
RTClib.h File Reference
#include <Adafruit_I2CDevice.h>
#include <Arduino.h>

Go to the source code of this file.

Classes

class  DateTime
 Simple general-purpose date/time class (no TZ / DST / leap seconds). More...
 
class  TimeSpan
 Timespan which can represent changes in time with seconds accuracy. More...
 
class  RTC_I2C
 A generic I2C RTC base class. DO NOT USE DIRECTLY. More...
 
class  RTC_DS1307
 RTC based on the DS1307 chip connected via I2C and the Wire library. More...
 
class  RTC_DS3231
 RTC based on the DS3231 chip connected via I2C and the Wire library. More...
 
class  RTC_PCF8523
 RTC based on the PCF8523 chip connected via I2C and the Wire library. More...
 
class  RTC_PCF8563
 RTC based on the PCF8563 chip connected via I2C and the Wire library. More...
 
class  RTC_Millis
 RTC using the internal millis() clock, has to be initialized before use. NOTE: this is immune to millis() rollover events. More...
 
class  RTC_Micros
 RTC using the internal micros() clock, has to be initialized before use. Unlike RTC_Millis, this can be tuned in order to compensate for the natural drift of the system clock. Note that now() has to be called more frequently than the micros() rollover period, which is approximately 71.6 minutes. More...
 

Macros

#define SECONDS_PER_DAY   86400L
 60 * 60 * 24 More...
 
#define SECONDS_FROM_1970_TO_2000   946684800
 Unixtime for 2000-01-01 00:00:00, useful for initialization.
 

Enumerations

enum  Ds1307SqwPinMode {
  DS1307_OFF = 0x00, DS1307_ON = 0x80, DS1307_SquareWave1HZ = 0x10, DS1307_SquareWave4kHz = 0x11,
  DS1307_SquareWave8kHz = 0x12, DS1307_SquareWave32kHz = 0x13
}
 
enum  Ds3231SqwPinMode {
  DS3231_OFF = 0x1C, DS3231_SquareWave1Hz = 0x00, DS3231_SquareWave1kHz = 0x08, DS3231_SquareWave4kHz = 0x10,
  DS3231_SquareWave8kHz = 0x18
}
 
enum  Ds3231Alarm1Mode {
  DS3231_A1_PerSecond = 0x0F, DS3231_A1_Second = 0x0E, DS3231_A1_Minute = 0x0C, DS3231_A1_Hour = 0x08,
  DS3231_A1_Date = 0x00, DS3231_A1_Day = 0x10
}
 
enum  Ds3231Alarm2Mode {
  DS3231_A2_PerMinute = 0x7, DS3231_A2_Minute = 0x6, DS3231_A2_Hour = 0x4, DS3231_A2_Date = 0x0,
  DS3231_A2_Day = 0x8
}
 
enum  Pcf8523SqwPinMode {
  PCF8523_OFF = 7, PCF8523_SquareWave1HZ = 6, PCF8523_SquareWave32HZ = 5, PCF8523_SquareWave1kHz = 4,
  PCF8523_SquareWave4kHz = 3, PCF8523_SquareWave8kHz = 2, PCF8523_SquareWave16kHz = 1, PCF8523_SquareWave32kHz = 0
}
 
enum  PCF8523TimerClockFreq {
  PCF8523_Frequency4kHz = 0, PCF8523_Frequency64Hz = 1, PCF8523_FrequencySecond = 2, PCF8523_FrequencyMinute = 3,
  PCF8523_FrequencyHour = 4
}
 
enum  PCF8523TimerIntPulse {
  PCF8523_LowPulse3x64Hz = 0, PCF8523_LowPulse4x64Hz = 1, PCF8523_LowPulse5x64Hz = 2, PCF8523_LowPulse6x64Hz = 3,
  PCF8523_LowPulse8x64Hz = 4, PCF8523_LowPulse10x64Hz = 5, PCF8523_LowPulse12x64Hz = 6, PCF8523_LowPulse14x64Hz = 7
}
 
enum  Pcf8523OffsetMode { PCF8523_TwoHours = 0x00, PCF8523_OneMinute = 0x80 }
 
enum  Pcf8563SqwPinMode {
  PCF8563_SquareWaveOFF = 0x00, PCF8563_SquareWave1Hz = 0x83, PCF8563_SquareWave32Hz = 0x82, PCF8563_SquareWave1kHz = 0x81,
  PCF8563_SquareWave32kHz = 0x80
}
 

Detailed Description

Original library by JeeLabs http://news.jeelabs.org/code/, released to the public domain

License: MIT (see LICENSE)

This is a fork of JeeLab's fantastic real time clock library for Arduino.

For details on using this library with an RTC module like the DS1307, PCF8523, or DS3231, see the guide at: https://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/overview

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Macro Definition Documentation

◆ SECONDS_PER_DAY

#define SECONDS_PER_DAY   86400L

60 * 60 * 24

Constants

Enumeration Type Documentation

◆ Ds1307SqwPinMode

DS1307 SQW pin mode settings

◆ Ds3231SqwPinMode

DS3231 SQW pin mode settings

Enumerator
DS3231_OFF 

Off

DS3231_SquareWave1Hz 

1Hz square wave

DS3231_SquareWave1kHz 

1kHz square wave

DS3231_SquareWave4kHz 

4kHz square wave

DS3231_SquareWave8kHz 

8kHz square wave

◆ Ds3231Alarm1Mode

DS3231 Alarm modes for alarm 1

Enumerator
DS3231_A1_PerSecond 

Alarm once per second

DS3231_A1_Second 

Alarm when seconds match

DS3231_A1_Minute 

Alarm when minutes and seconds match

DS3231_A1_Hour 

Alarm when hours, minutes and seconds match

DS3231_A1_Date 

Alarm when date (day of month), hours, minutes and seconds match

DS3231_A1_Day 

Alarm when day (day of week), hours, minutes and seconds match

◆ Ds3231Alarm2Mode

DS3231 Alarm modes for alarm 2

Enumerator
DS3231_A2_PerMinute 

Alarm once per minute (whenever seconds are 0)

DS3231_A2_Minute 

Alarm when minutes match

DS3231_A2_Hour 

Alarm when hours and minutes match

DS3231_A2_Date 

Alarm when date (day of month), hours and minutes match

DS3231_A2_Day 

Alarm when day (day of week), hours and minutes match

◆ Pcf8523SqwPinMode

PCF8523 INT/SQW pin mode settings

Enumerator
PCF8523_OFF 

Off

PCF8523_SquareWave1HZ 

1Hz square wave

PCF8523_SquareWave32HZ 

32Hz square wave

PCF8523_SquareWave1kHz 

1kHz square wave

PCF8523_SquareWave4kHz 

4kHz square wave

PCF8523_SquareWave8kHz 

8kHz square wave

PCF8523_SquareWave16kHz 

16kHz square wave

PCF8523_SquareWave32kHz 

32kHz square wave

◆ PCF8523TimerClockFreq

PCF8523 Timer Source Clock Frequencies for Timers A and B

Enumerator
PCF8523_Frequency4kHz 

1/4096th second = 244 microseconds, max 62.256 milliseconds

PCF8523_Frequency64Hz 

1/64th second = 15.625 milliseconds, max 3.984375 seconds

PCF8523_FrequencySecond 

1 second, max 255 seconds = 4.25 minutes

PCF8523_FrequencyMinute 

1 minute, max 255 minutes = 4.25 hours

PCF8523_FrequencyHour 

1 hour, max 255 hours = 10.625 days

◆ PCF8523TimerIntPulse

PCF8523 Timer Interrupt Low Pulse Width options for Timer B only

Enumerator
PCF8523_LowPulse3x64Hz 

46.875 ms 3/64ths second

PCF8523_LowPulse4x64Hz 

62.500 ms 4/64ths second

PCF8523_LowPulse5x64Hz 

78.125 ms 5/64ths second

PCF8523_LowPulse6x64Hz 

93.750 ms 6/64ths second

PCF8523_LowPulse8x64Hz 

125.000 ms 8/64ths second

PCF8523_LowPulse10x64Hz 

156.250 ms 10/64ths second

PCF8523_LowPulse12x64Hz 

187.500 ms 12/64ths second

PCF8523_LowPulse14x64Hz 

218.750 ms 14/64ths second

◆ Pcf8523OffsetMode

PCF8523 Offset modes for making temperature/aging/accuracy adjustments

Enumerator
PCF8523_TwoHours 

Offset made every two hours

PCF8523_OneMinute 

Offset made every minute

◆ Pcf8563SqwPinMode

PCF8563 CLKOUT pin mode settings

Enumerator
PCF8563_SquareWaveOFF 

Off

PCF8563_SquareWave1Hz 

1Hz square wave

PCF8563_SquareWave32Hz 

32Hz square wave

PCF8563_SquareWave1kHz 

1kHz square wave

PCF8563_SquareWave32kHz 

32kHz square wave