MCP7940
v1.2.0
Arduino Library for the MCP7940N and MCP7940M Real-time clocks
|
Class definition header for the MCP7940 from Microchip. Both the MCP7940N (with battery backup pin and the MCP7940M are supported with this library and they both use the same I2C address. This chip is a Real-Time-Clock with an I2C interface. The data sheet located at http://ww1.microchip.com/downloads/en/DeviceDoc/20002292B.pdf describes the functionality used in this library.
se is made of portions of Adafruit's RTClib Version 1.2.0 at https://github.com/adafruit/RTClib which is a fork of the original RTClib from Jeelabs. The re-used code encompasses only the classes for time and date.
This library is built with the standard "Doxyfile", which is located at https://github.com/Zanduino/Common/blob/main/Doxygen. As described on that page, there are only 5 environment variables used, and these are set in the project's actions file, located at https://github.com/Zanduino/MCP7940/blob/master/.github/workflows/ci-doxygen.yml Edit this file and set the 5 variables: PRETTYNAME, PROJECT_NAME, PROJECT_NUMBER, PROJECT_BRIEF and PROJECT_LOGO so that these values are used in the doxygen documentation. The local copy of the doxyfile should be in the project's root directory in order to do local doxygen testing, but the file is ignored on upload to GitHub.
Part of the GitHub actions for CI is running every source file through "clang-format" to ensure that coding formatting is done the same for all files. The configuration file ".clang-format" is located at https://github.com/Zanduino/Common/tree/main/clang-format and this is used for CI tests when pushing to GitHub. The local file, if present in the root directory, is ignored when committing and uploading.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Written by Arnd Arnd@ at Zand uino. Comhttps://www.github.com/SV-Zanshin
Version | Date | Developer | Comments |
---|---|---|---|
1.2.2 | 2023-06-12 | Mark-Wills | Issue #65 - Corrected return value |
1.2.2 | 2021-12-16 | BrotherV | Issue #63 - Add ESP8266 support for defining SDA and SCL pins. |
1.2.1 | 2021-05-23 | SV-Zanshin | Issue #60 - Correct handling of dates < 2000-01-01 |
1.2.1 | 2021-01-06 | SV-Zanshin | Issue #58 - Corrected return reference values in readRAM and readEUI and added writeEUI |
1.2.1 | 2021-01-05 | masterx1981 | Issue #58 - Add support for MCP79401 and MCP79402 read EUI data |
1.1.9 | 2020-11-26 | SV-Zanshin | Issue #54 - Optimize c++ code / resilience. Uniform Initialization. Consolidated I2C calls. |
1.1.8 | 2020-11-15 | SV-Zanshin | Issue #50 - Reformat with "clang-format" |
1.1.8 | 2020-11-14 | SV-Zanshin | Issue #49 - corrections for Battery Backup mode |
1.1.7 | 2020-05-18 | wvmarle | Issue #47 - adjust() method with compiler variables fix |
1.1.7 | 2019-02-07 | davidlehrian | Issue #43 - Calib. may cause overflow of "trim" variable |
1.1.7 | 2019-02-07 | davidlehrian | Issue #42 - calibrate(DateTime) to correct current dt/tm |
1.1.6 | 2019-01-27 | davidlehrian | Issue #36 - Reopened, changed statements to avoid warn. |
1.1.5 | 2019-01-19 | SV-Zanshin | Issue #40 - Change structure and layout to use doxygen |
1.1.5 | 2019-01-19 | INemesisI | Issue #37 - AlarmPolarity bit clearing on setAlarm() |
1.1.5 | 2019-01-19 | SV-Zanshin | Issue #39 - Changes to avoid Travis-CI warnings |
1.1.5 | 2019-01-18 | INemesisI | Issue #38 - Overflow on setting new TRIM value |
1.1.4 | 2018-12-15 | hexeguitar | Issue #36 - Overflow on I2C_MODES datatype corrected |
1.1.4 | 2018-12-15 | huynh213 | Issue #35 - MCP7940.adjust() resets the PWRFAIL/VBATEN |
1.1.3 | 2018-08-08 | amgrays | Issue #32 - invalid return on SetMFP corrected |
1.1.3 | 2018-08-05 | HannesJo0139 | Issue #31 - Calibration trim on negative numbers |
1.1.2 | 2018-08-04 | SV-Zanshin | Issue #28 - added calibrate() ovld for freq. calibration |
1.1.2 | 2018-07-08 | logicaprogrammabile | Issue #26 - regarding hour bitmasks |
1.1.1 | 2018-07-07 | SV-Zanshin | Fixed bugs introduced by 14, 20, and 21 |
1.1.1 | 2018-07-07 | wvmarle | Pull #21 - Additional changes |
1.1.1 | 2018-07-06 | wvmarle | Pull #20 - Numerous changes and enhancements |
1.1.0 | 2018-07-05 | wvmarle | Pull #14 - bug fixes to alarm state and comment cleanup |
1.0.8 | 2018-07-02 | SV-Zanshin | Added guard code for multiple I2C constant definitions |
1.0.8 | 2018-06-30 | SV-Zanshin | Issue #15 - Added I2C Speed selection |
1.0.7 | 2018-06-21 | SV-Zanshin | Issue #13 - DateTime.dayOfTheWeek() is 0-6 instead 1-7 |
1.0.6 | 2018-04-29 | SV-Zanshin | Issue #7 - Moved param defaults to prototypes |
1.0.6 | 2018-04-29 | SV-Zanshin | Issue #10 - Setting of alarm with WKDAY to future date |
1.0.5b | 2017-12-18 | SV-Zanshin | Issue #8 - Setting to 24-Hour clock |
1.0.5a | 2017-10-31 | SV-Zanshin | Issue #6 - Remove classification on template functions |
1.0.4c | 2017-08-13 | SV-Zanshin | Issue #5 - Remove checks after Wire.requestFrom() |
1.0.4b | 2017-08-08 | SV-Zanshin | Replaced readRAM and writeRAM with template functions |
1.0.4a | 2017-08-06 | SV-Zanshin | Removed unnecessary MCP7940_I2C_Delay and all references |
1.0.3 | 2017-08-05 | SV-Zanshin | Added calls for MCP7940N. getPowerFail(),clearPowerFail(), setBattery(). Added I2C_READ_ATTEMPTS to prevent I2C hang, added getPowerUp/Down() |
1.0.3a | 2017-07-29 | SV-Zanshin | Cleaned up comments, no code changes |
1.0.3 | 2017-07-29 | SV-Zanshin | getSQWSpeed(),setSQWSpeed(),setSQWState(),getSQWState() |
1.0.2 | 2017-07-29 | SV-Zanshin | getAlarm(),setAlarmState(),getAlarmState(),isAlarm()added optional setting setAlarm(). Fixed alarm 1 index |
1.0.1 | 2017-07-25 | SV-Zanshin | Overloaded Calibrate() to manually set trim factor |
1.0.0 | 2017-07-23 | SV-Zanshin | Cleaned up code, initial github upload |
1.0.2b | 2017-07-20 | SV-Zanshin | Added alarm handling |
1.0.1b | 2017-07-19 | SV-Zanshin | Added methods |
1.0.0b | 2017-07-17 | SV-Zanshin | Initial coding |