summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2020-06-21 23:37:21 +0200
committerDiego Barrios Romero <eldruin@gmail.com>2020-06-21 23:37:21 +0200
commit6726d11b249a9f02db429bbe730a970667a4f46c (patch)
tree2bcea9ebf11068862e87ca5dca1ae74e2a0435df
parente7856413d86ef5e5ecebc8eee33c2eed95b7888a (diff)
downloadads1x1x-async-6726d11b249a9f02db429bbe730a970667a4f46c.tar.gz
ads1x1x-async-6726d11b249a9f02db429bbe730a970667a4f46c.tar.xz
ads1x1x-async-6726d11b249a9f02db429bbe730a970667a4f46c.zip
Add example of new SlaveAddr methods to docs
-rw-r--r--src/lib.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 269edba..0c28c18 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -99,7 +99,7 @@
//! let dev = adc.destroy_ads1013();
//! ```
//!
-//! ### Create a driver instance for the ADS1013 with an alternative address
+//! ### Create a driver instance for the ADS1013 with an alternative address (method 1)
//!
//! ```no_run
//! use linux_embedded_hal::I2cdev;
@@ -110,6 +110,21 @@
//! let address = SlaveAddr::Alternative(a1, a0);
//! let adc = Ads1x1x::new_ads1013(dev, address);
//! ```
+
+//! ### Create a driver instance for the ADS1013 with an alternative address (method 2)
+//!
+//! Using helper `SlaveAddr` creation method depending on the connection of
+//! the `ADDR` pin.
+//!
+//! ```no_run
+//! use linux_embedded_hal::I2cdev;
+//! use ads1x1x::{Ads1x1x, SlaveAddr};
+//!
+//! let dev = I2cdev::new("/dev/i2c-1").unwrap();
+//! // `ADDR` pin connected to SDA results in the 0x4A effective address
+//! let address = SlaveAddr::new_sda();
+//! let adc = Ads1x1x::new_ads1013(dev, address);
+//! ```
//!
//! ### Make a one-shot measurement
//! ```no_run