From 6726d11b249a9f02db429bbe730a970667a4f46c Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Sun, 21 Jun 2020 23:37:21 +0200 Subject: Add example of new SlaveAddr methods to docs --- src/lib.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-54-g00ecf