diff --git a/src/channels.rs b/src/channels.rs index f4b12ea..27ea36e 100644 --- a/src/channels.rs +++ b/src/channels.rs @@ -1,4 +1,4 @@ -/// ADC input channel selection +/// ADC input channel selection. #[derive(Debug, Clone, Copy)] pub enum ChannelSelection { /// Measure single-ended signal on input channel 0. diff --git a/src/devices/common.rs b/src/devices/common.rs index 4216307..ee91328 100644 --- a/src/devices/common.rs +++ b/src/devices/common.rs @@ -6,7 +6,7 @@ macro_rules! impl_common_features { where I2C: embedded_hal::i2c::I2c, { - /// Read whether a measurement is currently in progress. + /// Checks whether a measurement is currently in progress. pub fn is_measurement_in_progress(&mut self) -> Result { let config = self.read_reg_u16::()?; Ok(!config.contains(Config::OS)) diff --git a/src/devices/features/tier1.rs b/src/devices/features/tier1.rs index 2320405..5a90661 100644 --- a/src/devices/features/tier1.rs +++ b/src/devices/features/tier1.rs @@ -8,8 +8,7 @@ macro_rules! impl_tier1_features { { /// Sets the data rate. pub fn set_data_rate(&mut self, rate: $DataRate) -> Result<(), E> { - let config = self.config.clone(); - let config = rate.configure(config); + let config = rate.configure(self.config); self.write_reg_u16(config)?; self.config = config; Ok(()) diff --git a/src/types.rs b/src/types.rs index 0d13ebd..e68b3ed 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,6 +1,6 @@ use crate::Config; -/// Data rate for ADS1013, ADS1014, ADS1015. +/// Data rate for ADS101x. #[derive(Debug, Clone, Copy, PartialEq)] pub enum DataRate12Bit { /// 128 SPS @@ -54,7 +54,7 @@ impl DataRate12Bit { } } -/// Data rate for ADS1113, ADS1114, ADS1115. +/// Data rate for ADS111x. #[derive(Debug, Clone, Copy, PartialEq)] pub enum DataRate16Bit { /// 8 SPS @@ -111,7 +111,7 @@ impl DataRate16Bit { } } -/// Comparator mode (only for ADS1x14, ADS1x15) +/// Comparator mode (only for ADS1x14, ADS1x15). #[derive(Debug, Clone, Copy, PartialEq)] pub enum ComparatorMode { /// Traditional comparator (default) @@ -129,7 +129,7 @@ pub enum ComparatorMode { Window, } -/// Comparator polarity (only for ADS1x14, ADS1x15) +/// Comparator polarity (only for ADS1x14, ADS1x15). #[derive(Debug, Clone, Copy, PartialEq)] pub enum ComparatorPolarity { /// Active low (default) @@ -138,7 +138,7 @@ pub enum ComparatorPolarity { ActiveHigh, } -/// Comparator polarity (only for ADS1x14, ADS1x15) +/// Comparator latching (only for ADS1x14, ADS1x15). /// /// Select whether the ALERT/RDY pin latches after being asserted or clears /// after conversions are within the margin of the upper and lower @@ -172,7 +172,7 @@ pub enum ComparatorQueue { Four, } -/// Full-scale range configuration for the programmable gain amplifier (PGA) (only for ADS1x14, ADS1x15) +/// Full-scale range configuration for the programmable gain amplifier (PGA) (only for ADS1x14, ADS1x15). /// /// This sets the input voltage measurable range. /// The FSR is fixed at ±2.048 V in the ADS1x13.