summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-21 08:18:16 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-21 08:18:16 +0100
commit2dec94ba529111e396c8b8c2b49de48084826eba (patch)
tree82e0bc8d0272ad2cd1e69a431ee8b3561f8aed3c /src
parent66e83785a255a7934842c44c5b26e85651a87b8a (diff)
downloadads1x1x-async-2dec94ba529111e396c8b8c2b49de48084826eba.tar.gz
ads1x1x-async-2dec94ba529111e396c8b8c2b49de48084826eba.tar.xz
ads1x1x-async-2dec94ba529111e396c8b8c2b49de48084826eba.zip
Add example of reading measurement in continuous mode
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs8
1 files changed, 7 insertions, 1 deletions
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`.