diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/features/tier2.rs | 8 | ||||
-rw-r--r-- | src/lib.rs | 11 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/devices/features/tier2.rs b/src/devices/features/tier2.rs index 067139a..2a35f7c 100644 --- a/src/devices/features/tier2.rs +++ b/src/devices/features/tier2.rs @@ -31,14 +31,14 @@ where Ok(()) } - /// Set comparator lower threshold - pub fn set_low_threshold(&mut self, value: i16) -> Result<(), Error<E>> { + /// Set raw comparator lower threshold + pub fn set_low_threshold_raw(&mut self, value: i16) -> Result<(), Error<E>> { let register_value = CONV::convert_threshold(value)?; self.iface.write_register(Register::LOW_TH, register_value) } - /// Set comparator upper threshold - pub fn set_high_threshold(&mut self, value: i16) -> Result<(), Error<E>> { + /// Set raw comparator upper threshold + pub fn set_high_threshold_raw(&mut self, value: i16) -> Result<(), Error<E>> { let register_value = CONV::convert_threshold(value)?; self.iface.write_register(Register::HIGH_TH, register_value) } @@ -9,7 +9,7 @@ //! - Make a measurement in one-shot mode. See: [`read()`]. //! - Set the data rate. See: [`set_data_rate()`]. //! - Set the full-scale range (gain amplifier). See [`set_full_scale_range()`]. -//! - Set the low and high thresholds. See: [`set_high_threshold()`]. +//! - Set the low and high thresholds. See: [`set_high_threshold_raw()`]. //! - Set the comparator mode. See: [`set_comparator_mode()`]. //! - Set the comparator polarity. See: [`set_comparator_polarity()`]. //! - Set the comparator latching. See: [`set_comparator_latching()`]. @@ -20,7 +20,7 @@ //! [`read()`]: struct.Ads1x1x.html#method.read //! [`set_data_rate()`]: struct.Ads1x1x.html#method.set_data_rate //! [`set_full_scale_range()`]: struct.Ads1x1x.html#method.set_full_scale_range -//! [`set_high_threshold()`]: struct.Ads1x1x.html#method.set_high_threshold +//! [`set_high_threshold_raw()`]: struct.Ads1x1x.html#method.set_high_threshold_raw //! [`set_comparator_mode()`]: struct.Ads1x1x.html#method.set_comparator_mode //! [`set_comparator_polarity()`]: struct.Ads1x1x.html#method.set_comparator_polarity //! [`set_comparator_latching()`]: struct.Ads1x1x.html#method.set_comparator_latching @@ -172,7 +172,7 @@ //! extern crate linux_embedded_hal as hal; //! extern crate ads1x1x; //! use ads1x1x::{ Ads1x1x, SlaveAddr, ComparatorQueue, ComparatorPolarity, -//! ComparatorMode, ComparatorLatching }; +//! ComparatorMode, ComparatorLatching, FullScaleRange }; //! //! # fn main() { //! let dev = hal::I2cdev::new("/dev/i2c-1").unwrap(); @@ -181,8 +181,9 @@ //! adc.set_comparator_queue(ComparatorQueue::Two).unwrap(); //! adc.set_comparator_polarity(ComparatorPolarity::ActiveHigh).unwrap(); //! adc.set_comparator_mode(ComparatorMode::Window).unwrap(); -//! adc.set_low_threshold(-1500).unwrap(); -//! adc.set_high_threshold(1500).unwrap(); +//! adc.set_full_scale_range(FullScaleRange::Within2_048V).unwrap(); +//! adc.set_low_threshold_raw(-1500).unwrap(); +//! adc.set_high_threshold_raw(1500).unwrap(); //! adc.set_comparator_latching(ComparatorLatching::Latching).unwrap(); //! # } //! ``` |