mirror of https://github.com/eldruin/ds323x-rs
Add example of new alarm setting method
parent
73302b1866
commit
ff632625b2
15
src/lib.rs
15
src/lib.rs
|
@ -421,6 +421,21 @@
|
||||||
//! rtc.enable_alarm2_interrupts().unwrap();
|
//! rtc.enable_alarm2_interrupts().unwrap();
|
||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
|
//!
|
||||||
|
//! ### Set the Alarm1 to a specific time
|
||||||
|
//!
|
||||||
|
//! ```no_run
|
||||||
|
//! extern crate ds323x;
|
||||||
|
//! extern crate linux_embedded_hal as hal;
|
||||||
|
//! use ds323x::{Ds323x, Hours, NaiveTime};
|
||||||
|
//!
|
||||||
|
//! # fn main() {
|
||||||
|
//! let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
|
||||||
|
//! let mut rtc = Ds323x::new_ds3231(dev);
|
||||||
|
//! let time = NaiveTime::from_hms(19, 59, 58);
|
||||||
|
//! rtc.set_alarm1_hms(time).unwrap();
|
||||||
|
//! # }
|
||||||
|
//! ```
|
||||||
|
|
||||||
#![deny(unsafe_code, missing_docs)]
|
#![deny(unsafe_code, missing_docs)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
Loading…
Reference in New Issue