mirror of
https://github.com/adafruit/RTClib.git
synced 2026-07-27 19:56:05 +00:00
actionified, formatted and doxy'd
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
name: Arduino Library CI
|
||||
|
||||
on: [pull_request, push, repository_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
repository: adafruit/ci-arduino
|
||||
path: ci
|
||||
|
||||
- name: pre-install
|
||||
run: bash ci/actions_install.sh
|
||||
|
||||
- name: test platforms
|
||||
run: python3 ci/build_platform.py main_platforms
|
||||
|
||||
- name: clang
|
||||
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
|
||||
|
||||
- name: doxygen
|
||||
env:
|
||||
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
|
||||
PRETTYNAME : "RTClib"
|
||||
run: bash ci/doxy_gen_and_deploy.sh
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
language: c
|
||||
sudo: false
|
||||
# Blacklist
|
||||
branches:
|
||||
except:
|
||||
- gh-pages
|
||||
cache:
|
||||
directories:
|
||||
- ~/arduino_ide
|
||||
- ~/.arduino15/packages/
|
||||
git:
|
||||
depth: false
|
||||
quiet: true
|
||||
env:
|
||||
global:
|
||||
- PRETTYNAME="Adafruit RTClib"
|
||||
# Optional, will default to "$TRAVIS_BUILD_DIR/Doxyfile"
|
||||
# - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile
|
||||
|
||||
before_install:
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh)
|
||||
|
||||
script:
|
||||
- build_main_platforms
|
||||
|
||||
# Generate and deploy documentation
|
||||
after_success:
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh)
|
||||
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh)
|
||||
@@ -1,19 +1,13 @@
|
||||
# Adafruit RTClib [](https://travis-ci.com/adafruit/RTClib)
|
||||
# RTClib [](https://github.com/adafruit/RTClib/actions)
|
||||
|
||||
This is a fork of JeeLab's fantastic real time clock library for Arduino.
|
||||
|
||||
For a tutorial 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
|
||||
|
||||
For the detailed API documentation, see https://adafruit.github.io/RTClib/html/index.html
|
||||
|
||||
Works great with Adafruit RTC breakouts:
|
||||
|
||||
- [DS3231 Precision RTC](https://www.adafruit.com/product/3013)
|
||||
- [PCF8523 RTC](https://www.adafruit.com/product/3295)
|
||||
- [DS1307 RTC](https://www.adafruit.com/product/3296)
|
||||
|
||||
To install, use the Arduino Library Manager to search for "RTClib", find "RTClib by Adafruit" and install the library.
|
||||
|
||||
Please note that dayOfTheWeek() ranges from 0 to 6 inclusive with 0 being 'Sunday'.
|
||||
|
||||
<!-- START COMPATIBILITY TABLE -->
|
||||
@@ -47,3 +41,30 @@ STM32F2 | | | X |
|
||||
* ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V
|
||||
|
||||
<!-- END COMPATIBILITY TABLE -->
|
||||
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
|
||||
|
||||
# Dependencies
|
||||
* [Adafruit BusIO](https://github.com/adafruit/Adafruit_BusIO)
|
||||
* [Adafruit Unified Sensor Driver](https://github.com/adafruit/Adafruit_Sensor)
|
||||
* [Adafruit GFX Library](https://github.com/adafruit/Adafruit-GFX-Library)
|
||||
|
||||
# Contributing
|
||||
|
||||
Contributions are welcome! Please read our [Code of Conduct](https://github.com/adafruit/RTClib/blob/master/CODE_OF_CONDUCT.md>)
|
||||
before contributing to help this project stay welcoming.
|
||||
|
||||
## Documentation and doxygen
|
||||
For the detailed API documentation, see https://adafruit.github.io/RTClib/html/index.html
|
||||
Documentation is produced by doxygen. Contributions should include documentation for any new code added.
|
||||
|
||||
Some examples of how to use doxygen can be found in these guide pages:
|
||||
|
||||
https://learn.adafruit.com/the-well-automated-arduino-library/doxygen
|
||||
|
||||
https://learn.adafruit.com/the-well-automated-arduino-library/doxygen-tips
|
||||
|
||||
Written by JeeLabs
|
||||
MIT license, check license.txt for more information
|
||||
All text above must be included in any redistribution
|
||||
|
||||
To install, use the Arduino Library Manager and search for "RTClib" and install the library.
|
||||
|
||||
+361
-350
File diff suppressed because it is too large
Load Diff
@@ -2,14 +2,16 @@
|
||||
/*!
|
||||
@file RTClib.h
|
||||
|
||||
Original library by JeeLabs http://news.jeelabs.org/code/, released to the public domain
|
||||
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
|
||||
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
|
||||
@@ -24,27 +26,29 @@
|
||||
class TimeSpan;
|
||||
|
||||
/** Registers */
|
||||
#define PCF8523_ADDRESS 0x68 ///< I2C address for PCF8523
|
||||
#define PCF8523_CLKOUTCONTROL 0x0F ///< Timer and CLKOUT control register
|
||||
#define PCF8523_CONTROL_3 0x02 ///< Control and status register 3
|
||||
#define PCF8523_OFFSET 0x0E ///< Offset register
|
||||
#define PCF8523_ADDRESS 0x68 ///< I2C address for PCF8523
|
||||
#define PCF8523_CLKOUTCONTROL 0x0F ///< Timer and CLKOUT control register
|
||||
#define PCF8523_CONTROL_3 0x02 ///< Control and status register 3
|
||||
#define PCF8523_OFFSET 0x0E ///< Offset register
|
||||
|
||||
#define DS1307_ADDRESS 0x68 ///< I2C address for DS1307
|
||||
#define DS1307_CONTROL 0x07 ///< Control register
|
||||
#define DS1307_NVRAM 0x08 ///< Start of RAM registers - 56 bytes, 0x08 to 0x3f
|
||||
#define DS1307_ADDRESS 0x68 ///< I2C address for DS1307
|
||||
#define DS1307_CONTROL 0x07 ///< Control register
|
||||
#define DS1307_NVRAM 0x08 ///< Start of RAM registers - 56 bytes, 0x08 to 0x3f
|
||||
|
||||
#define DS3231_ADDRESS 0x68 ///< I2C address for DS3231
|
||||
#define DS3231_TIME 0x00 ///< Time register
|
||||
#define DS3231_ALARM1 0x07 ///< Alarm 1 register
|
||||
#define DS3231_ALARM2 0x0B ///< Alarm 2 register
|
||||
#define DS3231_CONTROL 0x0E ///< Control register
|
||||
#define DS3231_STATUSREG 0x0F ///< Status register
|
||||
#define DS3231_TEMPERATUREREG 0x11 ///< Temperature register (high byte - low byte is at 0x12), 10-bit temperature value
|
||||
#define DS3231_ADDRESS 0x68 ///< I2C address for DS3231
|
||||
#define DS3231_TIME 0x00 ///< Time register
|
||||
#define DS3231_ALARM1 0x07 ///< Alarm 1 register
|
||||
#define DS3231_ALARM2 0x0B ///< Alarm 2 register
|
||||
#define DS3231_CONTROL 0x0E ///< Control register
|
||||
#define DS3231_STATUSREG 0x0F ///< Status register
|
||||
#define DS3231_TEMPERATUREREG \
|
||||
0x11 ///< Temperature register (high byte - low byte is at 0x12), 10-bit
|
||||
///< temperature value
|
||||
|
||||
/** Constants */
|
||||
#define SECONDS_PER_DAY 86400L ///< 60 * 60 * 24
|
||||
#define SECONDS_FROM_1970_TO_2000 946684800 ///< Unixtime for 2000-01-01 00:00:00, useful for initialization
|
||||
|
||||
#define SECONDS_PER_DAY 86400L ///< 60 * 60 * 24
|
||||
#define SECONDS_FROM_1970_TO_2000 \
|
||||
946684800 ///< Unixtime for 2000-01-01 00:00:00, useful for initialization
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@@ -64,53 +68,51 @@ class TimeSpan;
|
||||
/**************************************************************************/
|
||||
class DateTime {
|
||||
public:
|
||||
DateTime (uint32_t t = SECONDS_FROM_1970_TO_2000);
|
||||
DateTime (uint16_t year, uint8_t month, uint8_t day,
|
||||
uint8_t hour = 0, uint8_t min = 0, uint8_t sec = 0);
|
||||
DateTime (const DateTime& copy);
|
||||
DateTime (const char* date, const char* time);
|
||||
DateTime (const __FlashStringHelper* date, const __FlashStringHelper* time);
|
||||
|
||||
bool isValid() const;
|
||||
char* toString(char* buffer);
|
||||
DateTime(uint32_t t = SECONDS_FROM_1970_TO_2000);
|
||||
DateTime(uint16_t year, uint8_t month, uint8_t day, uint8_t hour = 0,
|
||||
uint8_t min = 0, uint8_t sec = 0);
|
||||
DateTime(const DateTime ©);
|
||||
DateTime(const char *date, const char *time);
|
||||
DateTime(const __FlashStringHelper *date, const __FlashStringHelper *time);
|
||||
char *toString(char *buffer);
|
||||
|
||||
/*!
|
||||
@brief Return the year.
|
||||
@return Year (range: 2000--2099).
|
||||
*/
|
||||
uint16_t year() const { return 2000 + yOff; }
|
||||
uint16_t year() const { return 2000 + yOff; }
|
||||
/*!
|
||||
@brief Return the month.
|
||||
@return Month number (1--12).
|
||||
*/
|
||||
uint8_t month() const { return m; }
|
||||
uint8_t month() const { return m; }
|
||||
/*!
|
||||
@brief Return the day of the month.
|
||||
@return Day of the month (1--31).
|
||||
*/
|
||||
uint8_t day() const { return d; }
|
||||
uint8_t day() const { return d; }
|
||||
/*!
|
||||
@brief Return the hour
|
||||
@return Hour (0--23).
|
||||
*/
|
||||
uint8_t hour() const { return hh; }
|
||||
uint8_t hour() const { return hh; }
|
||||
|
||||
uint8_t twelveHour() const;
|
||||
/*!
|
||||
@brief Return whether the time is PM.
|
||||
@return 0 if the time is AM, 1 if it's PM.
|
||||
*/
|
||||
uint8_t isPM() const { return hh >= 12; }
|
||||
uint8_t isPM() const { return hh >= 12; }
|
||||
/*!
|
||||
@brief Return the minute.
|
||||
@return Minute (0--59).
|
||||
*/
|
||||
uint8_t minute() const { return mm; }
|
||||
uint8_t minute() const { return mm; }
|
||||
/*!
|
||||
@brief Return the second.
|
||||
@return Second (0--59).
|
||||
*/
|
||||
uint8_t second() const { return ss; }
|
||||
uint8_t second() const { return ss; }
|
||||
|
||||
uint8_t dayOfTheWeek() const;
|
||||
|
||||
@@ -124,56 +126,55 @@ public:
|
||||
Format of the ISO 8601 timestamp generated by `timestamp()`. Each
|
||||
option corresponds to a `toString()` format as follows:
|
||||
*/
|
||||
enum timestampOpt{
|
||||
enum timestampOpt {
|
||||
TIMESTAMP_FULL, //!< `YYYY-MM-DDThh:mm:ss`
|
||||
TIMESTAMP_TIME, //!< `hh:mm:ss`
|
||||
TIMESTAMP_DATE //!< `YYYY-MM-DD`
|
||||
};
|
||||
String timestamp(timestampOpt opt = TIMESTAMP_FULL);
|
||||
|
||||
DateTime operator+(const TimeSpan& span);
|
||||
DateTime operator-(const TimeSpan& span);
|
||||
TimeSpan operator-(const DateTime& right);
|
||||
bool operator<(const DateTime& right) const;
|
||||
DateTime operator+(const TimeSpan &span);
|
||||
DateTime operator-(const TimeSpan &span);
|
||||
TimeSpan operator-(const DateTime &right);
|
||||
bool operator<(const DateTime &right) const;
|
||||
/*!
|
||||
@brief Test if one DateTime is greater (later) than another.
|
||||
@param right DateTime object to compare
|
||||
@return True if the left DateTime is later than the right one,
|
||||
false otherwise
|
||||
*/
|
||||
bool operator>(const DateTime& right) const { return right < *this; }
|
||||
bool operator>(const DateTime &right) const { return right < *this; }
|
||||
/*!
|
||||
@brief Test if one DateTime is less (earlier) than or equal to another
|
||||
@param right DateTime object to compare
|
||||
@return True if the left DateTime is earlier than or equal to the
|
||||
right one, false otherwise
|
||||
*/
|
||||
bool operator<=(const DateTime& right) const { return !(*this > right); }
|
||||
bool operator<=(const DateTime &right) const { return !(*this > right); }
|
||||
/*!
|
||||
@brief Test if one DateTime is greater (later) than or equal to another
|
||||
@param right DateTime object to compare
|
||||
@return True if the left DateTime is later than or equal to the right
|
||||
one, false otherwise
|
||||
*/
|
||||
bool operator>=(const DateTime& right) const { return !(*this < right); }
|
||||
bool operator==(const DateTime& right) const;
|
||||
bool operator>=(const DateTime &right) const { return !(*this < right); }
|
||||
bool operator==(const DateTime &right) const;
|
||||
/*!
|
||||
@brief Test if two DateTime objects are not equal.
|
||||
@param right DateTime object to compare
|
||||
@return True if the two objects are not equal, false if they are
|
||||
*/
|
||||
bool operator!=(const DateTime& right) const { return !(*this == right); }
|
||||
bool operator!=(const DateTime &right) const { return !(*this == right); }
|
||||
|
||||
protected:
|
||||
uint8_t yOff; ///< Year offset from 2000
|
||||
uint8_t m; ///< Month 1-12
|
||||
uint8_t d; ///< Day 1-31
|
||||
uint8_t hh; ///< Hours 0-23
|
||||
uint8_t mm; ///< Minutes 0-59
|
||||
uint8_t ss; ///< Seconds 0-59
|
||||
uint8_t yOff; ///< Year offset from 2000
|
||||
uint8_t m; ///< Month 1-12
|
||||
uint8_t d; ///< Day 1-31
|
||||
uint8_t hh; ///< Hours 0-23
|
||||
uint8_t mm; ///< Minutes 0-59
|
||||
uint8_t ss; ///< Seconds 0-59
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Timespan which can represent changes in time with seconds accuracy.
|
||||
@@ -181,60 +182,58 @@ protected:
|
||||
/**************************************************************************/
|
||||
class TimeSpan {
|
||||
public:
|
||||
TimeSpan (int32_t seconds = 0);
|
||||
TimeSpan (int16_t days, int8_t hours, int8_t minutes, int8_t seconds);
|
||||
TimeSpan (const TimeSpan& copy);
|
||||
TimeSpan(int32_t seconds = 0);
|
||||
TimeSpan(int16_t days, int8_t hours, int8_t minutes, int8_t seconds);
|
||||
TimeSpan(const TimeSpan ©);
|
||||
|
||||
/*!
|
||||
@brief Number of days in the TimeSpan
|
||||
e.g. 4
|
||||
@return int16_t days
|
||||
*/
|
||||
int16_t days() const { return _seconds / 86400L; }
|
||||
int16_t days() const { return _seconds / 86400L; }
|
||||
/*!
|
||||
@brief Number of hours in the TimeSpan
|
||||
This is not the total hours, it includes the days
|
||||
e.g. 4 days, 3 hours - NOT 99 hours
|
||||
@return int8_t hours
|
||||
*/
|
||||
int8_t hours() const { return _seconds / 3600 % 24; }
|
||||
int8_t hours() const { return _seconds / 3600 % 24; }
|
||||
/*!
|
||||
@brief Number of minutes in the TimeSpan
|
||||
This is not the total minutes, it includes days/hours
|
||||
e.g. 4 days, 3 hours, 27 minutes
|
||||
@return int8_t minutes
|
||||
*/
|
||||
int8_t minutes() const { return _seconds / 60 % 60; }
|
||||
int8_t minutes() const { return _seconds / 60 % 60; }
|
||||
/*!
|
||||
@brief Number of seconds in the TimeSpan
|
||||
This is not the total seconds, it includes the days/hours/minutes
|
||||
e.g. 4 days, 3 hours, 27 minutes, 7 seconds
|
||||
@return int8_t seconds
|
||||
*/
|
||||
int8_t seconds() const { return _seconds % 60; }
|
||||
int8_t seconds() const { return _seconds % 60; }
|
||||
/*!
|
||||
@brief Total number of seconds in the TimeSpan, e.g. 358027
|
||||
@return int32_t seconds
|
||||
*/
|
||||
int32_t totalseconds() const { return _seconds; }
|
||||
|
||||
TimeSpan operator+(const TimeSpan& right);
|
||||
TimeSpan operator-(const TimeSpan& right);
|
||||
TimeSpan operator+(const TimeSpan &right);
|
||||
TimeSpan operator-(const TimeSpan &right);
|
||||
|
||||
protected:
|
||||
int32_t _seconds; ///< Actual TimeSpan value is stored as seconds
|
||||
int32_t _seconds; ///< Actual TimeSpan value is stored as seconds
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** DS1307 SQW pin mode settings */
|
||||
enum Ds1307SqwPinMode {
|
||||
DS1307_OFF = 0x00, // Low
|
||||
DS1307_ON = 0x80, // High
|
||||
DS1307_SquareWave1HZ = 0x10, // 1Hz square wave
|
||||
DS1307_SquareWave4kHz = 0x11, // 4kHz square wave
|
||||
DS1307_SquareWave8kHz = 0x12, // 8kHz square wave
|
||||
DS1307_SquareWave32kHz = 0x13 // 32kHz square wave
|
||||
DS1307_OFF = 0x00, // Low
|
||||
DS1307_ON = 0x80, // High
|
||||
DS1307_SquareWave1HZ = 0x10, // 1Hz square wave
|
||||
DS1307_SquareWave4kHz = 0x11, // 4kHz square wave
|
||||
DS1307_SquareWave8kHz = 0x12, // 8kHz square wave
|
||||
DS1307_SquareWave32kHz = 0x13 // 32kHz square wave
|
||||
};
|
||||
|
||||
/**************************************************************************/
|
||||
@@ -245,23 +244,21 @@ enum Ds1307SqwPinMode {
|
||||
class RTC_DS1307 {
|
||||
public:
|
||||
boolean begin(void);
|
||||
static void adjust(const DateTime& dt);
|
||||
static void adjust(const DateTime &dt);
|
||||
uint8_t isrunning(void);
|
||||
static DateTime now();
|
||||
static Ds1307SqwPinMode readSqwPinMode();
|
||||
static void writeSqwPinMode(Ds1307SqwPinMode mode);
|
||||
uint8_t readnvram(uint8_t address);
|
||||
void readnvram(uint8_t* buf, uint8_t size, uint8_t address);
|
||||
void readnvram(uint8_t *buf, uint8_t size, uint8_t address);
|
||||
void writenvram(uint8_t address, uint8_t data);
|
||||
void writenvram(uint8_t address, uint8_t* buf, uint8_t size);
|
||||
void writenvram(uint8_t address, uint8_t *buf, uint8_t size);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** DS3231 SQW pin mode settings */
|
||||
enum Ds3231SqwPinMode {
|
||||
DS3231_OFF = 0x01, // Off
|
||||
DS3231_SquareWave1Hz = 0x00, // 1Hz square wave
|
||||
DS3231_OFF = 0x01, // Off
|
||||
DS3231_SquareWave1Hz = 0x00, // 1Hz square wave
|
||||
DS3231_SquareWave1kHz = 0x08, // 1kHz square wave
|
||||
DS3231_SquareWave4kHz = 0x10, // 4kHz square wave
|
||||
DS3231_SquareWave8kHz = 0x18 // 8kHz square wave
|
||||
@@ -293,37 +290,35 @@ enum Ds3231Alarm2Mode {
|
||||
class RTC_DS3231 {
|
||||
public:
|
||||
boolean begin(void);
|
||||
static void adjust(const DateTime& dt);
|
||||
static void adjust(const DateTime &dt);
|
||||
bool lostPower(void);
|
||||
static DateTime now();
|
||||
static Ds3231SqwPinMode readSqwPinMode();
|
||||
static void writeSqwPinMode(Ds3231SqwPinMode mode);
|
||||
bool setAlarm1(const DateTime& dt, Ds3231Alarm1Mode alarm_mode);
|
||||
bool setAlarm2(const DateTime& dt, Ds3231Alarm2Mode alarm_mode);
|
||||
bool setAlarm1(const DateTime &dt, Ds3231Alarm1Mode alarm_mode);
|
||||
bool setAlarm2(const DateTime &dt, Ds3231Alarm2Mode alarm_mode);
|
||||
void disableAlarm(uint8_t alarm_num);
|
||||
void clearAlarm(uint8_t alarm_num);
|
||||
bool alarmFired(uint8_t alarm_num);
|
||||
static float getTemperature(); // in Celcius degree
|
||||
static float getTemperature(); // in Celcius degree
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** PCF8523 SQW pin mode settings */
|
||||
enum Pcf8523SqwPinMode {
|
||||
PCF8523_OFF = 7, // Off
|
||||
PCF8523_SquareWave1HZ = 6, // 1Hz square wave
|
||||
PCF8523_SquareWave32HZ = 5, // 32Hz square wave
|
||||
PCF8523_SquareWave1kHz = 4, // 1kHz square wave
|
||||
PCF8523_SquareWave4kHz = 3, // 4kHz square wave
|
||||
PCF8523_SquareWave8kHz = 2, // 8kHz square wave
|
||||
PCF8523_OFF = 7, // Off
|
||||
PCF8523_SquareWave1HZ = 6, // 1Hz square wave
|
||||
PCF8523_SquareWave32HZ = 5, // 32Hz square wave
|
||||
PCF8523_SquareWave1kHz = 4, // 1kHz square wave
|
||||
PCF8523_SquareWave4kHz = 3, // 4kHz square wave
|
||||
PCF8523_SquareWave8kHz = 2, // 8kHz square wave
|
||||
PCF8523_SquareWave16kHz = 1, // 16kHz square wave
|
||||
PCF8523_SquareWave32kHz = 0 // 32kHz square wave
|
||||
};
|
||||
|
||||
/** PCF8523 Offset modes for making temperature/aging/accuracy adjustments */
|
||||
enum Pcf8523OffsetMode {
|
||||
PCF8523_TwoHours = 0x00, // Offset made every two hours
|
||||
PCF8523_OneMinute = 0x80 // Offset made every minute
|
||||
PCF8523_TwoHours = 0x00, // Offset made every two hours
|
||||
PCF8523_OneMinute = 0x80 // Offset made every minute
|
||||
};
|
||||
|
||||
/**************************************************************************/
|
||||
@@ -334,7 +329,7 @@ enum Pcf8523OffsetMode {
|
||||
class RTC_PCF8523 {
|
||||
public:
|
||||
boolean begin(void);
|
||||
void adjust(const DateTime& dt);
|
||||
void adjust(const DateTime &dt);
|
||||
boolean initialized(void);
|
||||
static DateTime now();
|
||||
|
||||
@@ -343,11 +338,10 @@ public:
|
||||
void calibrate(Pcf8523OffsetMode mode, int8_t offset);
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief RTC using the internal millis() clock, has to be initialized before use.
|
||||
NOTE: this is immune to millis() rollover events.
|
||||
@brief RTC using the internal millis() clock, has to be initialized before
|
||||
use. NOTE: this is immune to millis() rollover events.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
class RTC_Millis {
|
||||
@@ -356,17 +350,17 @@ public:
|
||||
@brief Start the RTC
|
||||
@param dt DateTime object with the date/time to set
|
||||
*/
|
||||
static void begin(const DateTime& dt) { adjust(dt); }
|
||||
static void adjust(const DateTime& dt);
|
||||
static void begin(const DateTime &dt) { adjust(dt); }
|
||||
static void adjust(const DateTime &dt);
|
||||
static DateTime now();
|
||||
|
||||
protected:
|
||||
static uint32_t lastUnix; ///< Unix time from the previous call to now() - prevents rollover issues
|
||||
static uint32_t lastMillis; ///< the millis() value corresponding to the last **full second** of Unix time
|
||||
static uint32_t lastUnix; ///< Unix time from the previous call to now() -
|
||||
///< prevents rollover issues
|
||||
static uint32_t lastMillis; ///< the millis() value corresponding to the last
|
||||
///< **full second** of Unix time
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief RTC using the internal micros() clock, has to be initialized before
|
||||
@@ -382,15 +376,18 @@ public:
|
||||
@brief Start the RTC
|
||||
@param dt DateTime object with the date/time to set
|
||||
*/
|
||||
static void begin(const DateTime& dt) { adjust(dt); }
|
||||
static void adjust(const DateTime& dt);
|
||||
static void begin(const DateTime &dt) { adjust(dt); }
|
||||
static void adjust(const DateTime &dt);
|
||||
static void adjustDrift(int ppm);
|
||||
static DateTime now();
|
||||
|
||||
protected:
|
||||
static uint32_t microsPerSecond; ///< Number of microseconds reported by micros() per "true" (calibrated) second
|
||||
static uint32_t lastUnix; ///< Unix time from the previous call to now() - prevents rollover issues
|
||||
static uint32_t lastMicros; ///< micros() value corresponding to the last full second of Unix time
|
||||
static uint32_t microsPerSecond; ///< Number of microseconds reported by
|
||||
///< micros() per "true" (calibrated) second
|
||||
static uint32_t lastUnix; ///< Unix time from the previous call to now() -
|
||||
///< prevents rollover issues
|
||||
static uint32_t lastMicros; ///< micros() value corresponding to the last full
|
||||
///< second of Unix time
|
||||
};
|
||||
|
||||
#endif // _RTCLIB_H_
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
name=RTClib
|
||||
version=1.4.1
|
||||
version=1.4.2
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=A fork of Jeelab's fantastic RTC library
|
||||
@@ -7,3 +7,4 @@ paragraph=A fork of Jeelab's fantastic RTC library
|
||||
category=Timing
|
||||
url=https://github.com/adafruit/RTClib
|
||||
architectures=*
|
||||
depends=TinyWireM, OneWire
|
||||
|
||||
Reference in New Issue
Block a user