You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-5Lines changed: 20 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,18 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
13
13
14
14
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/gpl.html>
15
15
16
-
## Important note: Library v2.0.0
16
+
## Version 3.0.0 notes
17
+
Version 3.0.0 adds the ability to address different I2C peripherals for microcontrollers that have more than one (e.g. `Wire`, `Wire1`, etc.) There is one situation that is not backwards compatible with earlier versions of the library. Code that calls `setSyncProvider()` in the [Time library](https://github.com/PaulStoffregen/Time), e.g.:
18
+
```c++
19
+
setSyncProvider(myRTC.get);
20
+
```
21
+
Needs to change as follows:
22
+
```c++
23
+
setSyncProvider([](){return myRTC.get();});
24
+
```
25
+
This uses a lambda to provide the Time library with a static function, which it requires. The `MCP79412::get()` function was static in previous versions of the library, but no longer is in v3.0.0. This allows the flexibility to operate with different I2C peripherals.
26
+
27
+
## Version 2.0.0 notes
17
28
The 2.0.0 version of the library has some significant changes and is not completely backwards compatible with earlier versions. These changes provide a more consistent API and reduce the possibility of name collisions. While sketches using this library will likely require changes as a result, these should be mostly straightforward.
18
29
19
30
- The library no longer defines an `MCP79412RTC` object, therefore each sketch needs to define one. (Previous versions of the library defined an `MCP79412RTC` object named `RTC`, although only for AVR architecture. Consider using a name other than `RTC` as this can cause a name collision on some architectures.)
@@ -35,6 +46,7 @@ The following example sketches are included with the **MCP79412RTC** library:
35
46
-**rtcSet1:** Set the RTC date and time using a hard-coded value in the sketch.
36
47
-**rtcSet2:** Similar to **rtcSet1**, a different way to hard-code the date and time.
37
48
-**rtcSet3:** Set the RTC to the sketch compile date and time.
49
+
-**rtc_wire1:** Raspberry Pi Pico example using `Wire1`.
38
50
-**SetSerial:** Set the RTC's date, time, and calibration register from the Arduino serial monitor.
39
51
-**TimeRTC:** Similar to the example of the same name provided with the **Time** library.
40
52
-**PowerOutageLogger:** A comprehensive example that implements a power failure logger using the MCP79412's ability to capture power down and power up times. Power failure events are logged to the MCP79412's SRAM. Output is to the Arduino serial monitor.
@@ -71,18 +83,21 @@ Symbolic names used with the squareWave() function (described below).
71
83
- SQWAVE_NONE
72
84
73
85
## Constructor
74
-
### MCP79412RTC()
86
+
### MCP79412RTC(TwoWire& wire)
75
87
##### Description
76
88
Instantiates an `MCP79412RTC` object.
77
89
##### Syntax
78
-
`MCP79412RTC myRTC;`
90
+
`MCP79412RTC myRTC(wire);`
79
91
##### Parameters
80
-
None.
92
+
**wire:** An optional parameter to specify which I2C bus to use. If omitted, defaults to `Wire`. *(TwoWire&)*
0 commit comments