ArduinoLibs
|
Base class for realtime clock handlers. More...
#include <RTC.h>
Public Types | |
enum | DayOfWeek { Monday = 1, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday } |
Day of the week corresponding to a date. More... | |
Public Member Functions | |
RTC () | |
Constructs a new realtime clock handler. More... | |
virtual bool | hasUpdates () |
Returns true if the realtime clock has updated since the last call to this function. More... | |
virtual void | readTime (RTCTime *value) |
Reads the current time from the realtime clock into value. More... | |
virtual void | readDate (RTCDate *value) |
Reads the current date from the realtime clock into value. More... | |
virtual void | writeTime (const RTCTime *value) |
Updates the time in the realtime clock to match value. More... | |
virtual void | writeDate (const RTCDate *value) |
Updates the date in the realtime clock to match value. More... | |
virtual void | readAlarm (uint8_t alarmNum, RTCAlarm *value) |
Reads the details of the alarm with index alarmNum into value. More... | |
virtual void | writeAlarm (uint8_t alarmNum, const RTCAlarm *value) |
Updates the details of the alarm with index alarmNum from value. More... | |
virtual int | byteCount () const |
Returns the number of bytes of non-volatile memory that can be used for storage of arbitrary settings, excluding storage used by alarms. More... | |
virtual uint8_t | readByte (uint8_t offset) |
Reads the byte at offset within the realtime clock's non-volatile memory. More... | |
virtual void | writeByte (uint8_t offset, uint8_t value) |
Writes value to offset within the realtime clock's non-volatile memory. More... | |
virtual int | readTemperature () |
Reads the value of the temperature sensor and returns the temperature in quarters of a degree celcius. More... | |
Static Public Member Functions | |
static void | adjustDays (RTCDate *date, uint8_t flags) |
Adjusts date up or down one day according to flags. More... | |
static void | adjustMonths (RTCDate *date, uint8_t flags) |
Adjusts date up or down one month according to flags. More... | |
static void | adjustYears (RTCDate *date, uint8_t flags) |
Adjusts date up or down one year according to flags. More... | |
static DayOfWeek | dayOfWeek (const RTCDate *date) |
Returns the day of the week corresponding to date. More... | |
Static Public Attributes | |
static const uint8_t | ALARM_COUNT = 4 |
Number of alarms that are supported by RTC::readAlarm() and RTC::writeAlarm(). | |
static const int | NO_TEMPERATURE = 32767 |
Value that is returned from readTemperature() if the realtime clock chip cannot determine the temperature. | |
static const uint8_t | INCREMENT = 0x0000 |
Increment the day, month, or year in a call to adjustDays(), adjustMonths(), or adjustYears(). | |
static const uint8_t | DECREMENT = 0x0001 |
Decrement the day, month, or year in a call to adjustDays(), adjustMonths(), or adjustYears(). | |
static const uint8_t | WRAP = 0x0002 |
Wrap around to the beginning of the current month/year rather than advance to the next one. | |
Base class for realtime clock handlers.
This class simplifies the process of reading and writing the time and date information in a realtime clock chip. The class also provides support for reading and writing information about alarms and other clock settings.
It is intended that the application will instantiate a subclass of this class to handle the specific realtime clock chip in the system. The default implementation in RTC simulates a clock based on the value of millis(), with alarms and clock settings stored in main memory.
Because the common DS1307 and DS3232 realtime clock chips use a 2-digit year, this class is also limited to dates between 2000 and 2099 inclusive.
enum RTC::DayOfWeek |
RTC::RTC | ( | ) |
Constructs a new realtime clock handler.
|
static |
Adjusts date up or down one day according to flags.
|
static |
Adjusts date up or down one month according to flags.
|
static |
Adjusts date up or down one year according to flags.
|
virtual |
Returns the number of bytes of non-volatile memory that can be used for storage of arbitrary settings, excluding storage used by alarms.
|
static |
|
virtual |
|
virtual |
Reads the details of the alarm with index alarmNum into value.
The alarmNum parameter must be between 0 and ALARM_COUNT - 1.
Alarm details are stored at the end of the realtime clock's non-volatile memory.
|
virtual |
Reads the byte at offset within the realtime clock's non-volatile memory.
The offset parameter must be between 0 and byteCount() - 1.
|
virtual |
Reads the current date from the realtime clock into value.
The time should be read first with readTime() as the default implementation only advances the date when the time is read and it crosses midnight.
|
virtual |
|
virtual |
Reads the current time from the realtime clock into value.
|
virtual |
Updates the details of the alarm with index alarmNum from value.
The alarmNum parameter must be between 0 and ALARM_COUNT - 1.
Alarm details are stored at the end of the realtime clock's non-volatile memory.
|
virtual |
Writes value to offset within the realtime clock's non-volatile memory.
The offset parameter must be between 0 and byteCount() - 1.
|
virtual |
Updates the date in the realtime clock to match value.
|
virtual |
Updates the time in the realtime clock to match value.