Crates.io | rv3028c7-rtc |
lib.rs | rv3028c7-rtc |
version | 0.5.2 |
source | src |
created_at | 2023-11-04 23:05:41.199076 |
updated_at | 2023-12-08 23:59:55.287127 |
description | RV-3028-C7 and similar Real Time Clock (RTC) no_std driver |
homepage | |
repository | https://github.com/tstellanova/rv3028c7-rtc |
max_upload_size | |
id | 1025636 |
size | 1,712,779 |
Rust no_std
driver for RV-3028-C7 and similar Real Time Clocks (RTC)
manufactured by Micro Crystal AG, Switzerland.
Based on the
Application Manual
downloaded November 2023.
This driver provides many methods for reading and writing the i2c registers of the RTC, but it does not fully exercise all the features of the RTC.
All of the examples have been run and tested on a raspberry pi running linux, for example with the command line:
cargo run --example rpil
from the linux command line.
These examples all assume there is a single RTC connected directly to a raspberry pi-like linux host.
rpil
demonstrates some basic interactions with the RTC attached to eg a Raspberry Pi host.
event_log
shows how to configure and enable event logging (for example,
detecting interrupt signals on the EVI pin)
alarm_int
shows how to set and get the alarm, and check for alarm trigger
trickle
shows how to enable and disable trickle charging, as well as enable
Vbackup switchover
countdown
demonstrates setting the Periodic Countdown Timer for repeating and
one-shot modes.
set_alarm
shows setting the alarm
These examples all assume that there are multiple RTCs connected to the host via an i2c mux (something like the TCA9548A)
muxit
demonstrates talking to two RTCs (with the same i2c address) via TCA9548A-like i2c mux.
See the high-level wiring diagram schematic.comp_mux
compares the output of four independent RTCs (two each of RV-3028-C7 and DS3231)
and detects when they drift apart (usually after multiple days).
See the associated quad RTC wiring diagram.trickle_mux
shows how to configure and confirm the backup voltage supply trickle charger.RUST_BACKTRACE=1 cargo test --tests
This will build and run only the tests, on any host platform.
These tests do not require a real hardware RTC to be connected to the host.
Note that plain cargo test
currently also builds all examples,
and if you're testing on a non-linux platform the linux_embedded_hal
-based examples will fail to build.
Here's a breadboard with four RTCs connected via an i2c mux (for the RTC comparison example)