Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/embedded/rtc/ds3231"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
hal |
std/embedded/hal |
ds3231.dodo |
time |
std/time |
ds3231.dodo |
ADDRESS
Constant · Source
The chip’s I2C address.
pub const ADDRESS: u8 = 0x68
FIRST_YEAR
Constant · Source
The first and last years the chip counts.
pub const FIRST_YEAR: i32 = 2000
LAST_YEAR
Constant · Source
pub const LAST_YEAR: i32 = 2099
Clock
Struct · Source
pub struct Clock<B: hal.I2c>: hal.Rtc + hal.RtcAlarm {
// Private implementation fields omitted.
}
Clock.new
Function · Source
A clock chip at ADDRESS on
bus. Nothing is sent until it is used.
pub fn new(bus: B) -> Clock<B> from(bus)
Clock.is_set
Function · Source
True once the time has been set and the oscillator has run since.
pub fn is_set(&mut self) -> bool!hal.Error
Clock.resolution_ms
Function · Source
pub fn resolution_ms(&self) -> u32
Clock.now_ms
Function · Source
The time, read in one transaction so the fields agree. Busy if the clock is not set.
pub fn now_ms(&mut self) -> u64!hal.Error
Clock.set_ms
Function · Source
Set the time in 24-hour mode, start the oscillator on battery power too, and clear the oscillator-stopped flag. InvalidInput outside the years 2000 to 2099.
pub fn set_ms(&mut self, time_ms: u64) -> void!hal.Error
Clock.set_alarm_ms
Function · Source
Fire at the first whole second at or after
time_ms, at most 28 days ahead; a time already reached fires at once.
pub fn set_alarm_ms(&mut self, time_ms: u64) -> void!hal.Error
Clock.alarm_fired
Function · Source
pub fn alarm_fired(&mut self) -> bool!hal.Error
Clock.clear_alarm
Function · Source
Disarm the alarm and release INT/SQW.
pub fn clear_alarm(&mut self) -> void!hal.Error
Clock.temperature_quarters
Function · Source
The chip’s temperature sensor, which its crystal compensation uses, in quarters of a degree Celsius. It measures every 64 seconds.
pub fn temperature_quarters(&mut self) -> i32!hal.Error
Clock.release
Function · Source
Give back the bus. The chip keeps counting, and an armed alarm stays armed in it.
pub fn release(self) -> B from(self)