From 2dec94ba529111e396c8b8c2b49de48084826eba Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Wed, 21 Nov 2018 08:18:16 +0100 Subject: Add example of reading measurement in continuous mode --- src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 20f5857..9491baa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,7 +133,7 @@ //! # } //! ``` //! -//! ### Change into continuous conversion mode +//! ### Change into continuous conversion mode and read the last measurement //! //! ```no_run //! extern crate linux_embedded_hal as hal; @@ -145,9 +145,15 @@ //! let address = SlaveAddr::default(); //! let adc = Ads1x1x::new_ads1013(dev, address); //! let mut adc = adc.into_continuous().unwrap(); +//! adc.start().unwrap(); +//! while(!adc.is_measurement_in_progress().unwrap()) { +//! // some delay... +//! } +//! let measurement = adc.read().unwrap(); //! # } //! ``` //! +//! //! ### Set the data rate //! For 12-bit devices, the available data rates are given by `DataRate12Bit`. //! For 16-bit devices, the available data rates are given by `DataRate16Bit`. -- cgit v1.2.3-54-g00ecf