The RV-3028-C7 is an extremely precise, extremely low power, highly configurable RTC. Under ideal conditions it runs at approximately 40nA with +/-5ppm per year of deviation (+/- 160 seconds worst case per year). This library was originally forked from the Sparkfun RV-1805 library, and costumized and enhanced to the RV-3028-C7.
This library allows the user to:
- Set time using hard numbers or the BUILD_TIME from the Arduino compiler
- Read time
- Configure various aspects of the RTC including setting of alarms, countdown timers, periodic time update interrupts, trickle charging, power switchover mode and programmable clock output.
Examples are included to get you started (but still missing for CountdownTimer, PeriodicTimeUpdate Interrupt and Programmable Clock Output).
- /examples - Example sketches for the library (.ino). Run these from the Arduino IDE.
- /src - Source files for the library (.cpp, .h).
- keywords.txt - Keywords from this library that will be highlighted in the Arduino IDE.
- library.properties - General library properties for the Arduino package manager.
The library enables the following functions:
Please call begin() sometime after initializing the I2C interface with Wire.begin().
Please call "updateTime()" before calling one of the other getTime functions.
Attention: UNIX Time and real time are INDEPENDENT!
enableAlarmInterrupt(min, hour, date_or_weekday, bool setWeekdayAlarm_not_Date, mode, bool enable_clock_output = false)
Set the alarm mode in the following way:
0: When minutes, hours and weekday/date match (once per weekday/date)
1: When hours and weekday/date match (once per weekday/date)
2: When minutes and weekday/date match (once per hour per weekday/date)
3: When weekday/date match (once per weekday/date)
4: When hours and minutes match (once per day)
5: When hours match (once per day)
6: When minutes match (once per hour)
7: All disabled – Default value
If you want to set a weekday alarm (setWeekdayAlarm_not_Date = true), set date_or_weekday from 0 (Sunday) to 6 (Saturday).
For further information about the alarm mode see Application Manual p. 68.
Thanks @JasonEdinburgh for this enhancement.
setTimer(bool timer_repeat, uint16_t timer_frequency, uint16_t timer_value, bool setInterrupt, bool start_timer, bool enable_clock_output = false)
timer_repeat specifies either Single or Repeat Mode for the Periodic Countdown Timer.
Setting of timer_frequency:
timer_frequency | error on first time | max. duration (timer_value = 4095) | |
---|---|---|---|
4096 (default) | 4096Hz | 122us | 0.9998s |
64 | 64Hz | 7.813ms | 63.984s |
1 | 1Hz | 7.813ms | 4095s |
60000 | 1/60Hz | 7.813ms | 4095min |
Countdown Period [s] = Timer Value / Timer Frequency
See Application Manual p. 63 for more information.
Thanks @JasonEdinburgh for this enhancement.
every_second specifies the interrupt to occur either every second or every minute.
At "enableTrickleCharge" you can choose the series resistor:
TCR_3K for 3kOhm
TCR_5K for 5kOhm
TCR_9K for 9kOhm
TCR_15K for 15kOhm
See Application Manual p. 48 for more information.
0 = Switchover disabled
1 = Direct Switching Mode
2 = Standby Mode
3 = Level Switching Mode
See Application Manual p. 45 for more information.
Set Clockout Frequency freq as follows:
freq | result |
---|---|
FD_CLKOUT_32k | 32.768 kHz |
FD_CLKOUT_8192 | 8192 Hz |
FD_CLKOUT_1024 | 1024 Hz |
FD_CLKOUT_64 | 64 Hz |
FD_CLKOUT_32 | 32 Hz |
FD_CLKOUT_1 | 1 Hz |
FD_CLKOUT_TIMER | Predefined periodic countdown timer interrupt |
FD_CLKOUT_LOW | CLKOUT = LOW |
See Application Manual p. 48 for more information. 'enableInterruptControlledClockout' generally enables the Interrupt Controlled Clockout (required for triggering Clockout at Alarm, PeriodicUpdate and CountdownTimer Interrupts).
This product is open source!
Please review the LICENSE.md file for license information.
If you have any questions or concerns on licensing, please contact [email protected].
Distributed as-is; no warranty is given.