diff options
author | Diego Barrios Romero <eldruin@gmail.com> | 2020-06-21 23:37:21 +0200 |
---|---|---|
committer | Diego Barrios Romero <eldruin@gmail.com> | 2020-06-21 23:37:21 +0200 |
commit | 6726d11b249a9f02db429bbe730a970667a4f46c (patch) | |
tree | 2bcea9ebf11068862e87ca5dca1ae74e2a0435df | |
parent | e7856413d86ef5e5ecebc8eee33c2eed95b7888a (diff) | |
download | ads1x1x-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.rs | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -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 |