From 672cd40b545eecad2b1f5b6bac3874202031e1b4 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Wed, 31 Oct 2018 07:08:36 +0100 Subject: [PATCH] Add example of square-wave generation --- src/lib.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index ddb7a1e..67c37ec 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -301,6 +301,23 @@ //! # } //! ``` //! +//! ### Enable the square-wave output with a frequency of 4.096Hz +//! +//! ```no_run +//! extern crate linux_embedded_hal as hal; +//! extern crate ds323x; +//! use ds323x::{ Ds323x, SqWFreq }; +//! +//! # fn main() { +//! let dev = hal::I2cdev::new("/dev/i2c-1").unwrap(); +//! let mut rtc = Ds323x::new_ds3231(dev); +//! rtc.set_square_wave_frequency(SqWFreq::_4_096Hz).unwrap(); +//! // The same output pin can be used for interrupts or as square-wave output +//! rtc.use_int_sqw_output_as_square_wave().unwrap(); +//! rtc.enable_square_wave().unwrap(); +//! # } +//! ``` +//! //! ### Set the aging offset //! //! ```no_run