Add example of new alarm setting method

pull/5/head
Diego Barrios Romero 2020-07-10 21:59:54 +02:00
parent 73302b1866
commit ff632625b2
1 changed files with 15 additions and 0 deletions

View File

@ -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]