Skip to content

Commit

Permalink
Clean up code.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Jan 14, 2024
1 parent b5f84b8 commit a6a2b78
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/channels.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/devices/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ macro_rules! impl_common_features {
where
I2C: embedded_hal::i2c::I2c<Error = E>,
{
/// 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<bool, E> {
let config = self.read_reg_u16::<Config>()?;
Ok(!config.contains(Config::OS))
Expand Down
3 changes: 1 addition & 2 deletions src/devices/features/tier1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
12 changes: 6 additions & 6 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a6a2b78

Please sign in to comment.