summaryrefslogtreecommitdiffstats
path: root/src/devices/mode
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/mode')
-rw-r--r--src/devices/mode/continuous.rs8
-rw-r--r--src/devices/mode/mod.rs2
-rw-r--r--src/devices/mode/oneshot.rs13
3 files changed, 11 insertions, 12 deletions
diff --git a/src/devices/mode/continuous.rs b/src/devices/mode/continuous.rs
index edc87c2..d514a9a 100644
--- a/src/devices/mode/continuous.rs
+++ b/src/devices/mode/continuous.rs
@@ -1,4 +1,4 @@
-//! Continuous measurement mode
+//! Continuous measurement mode.
use crate::{
conversion, devices::OperatingMode, mode, Ads1x1x, ChannelId, Error, ModeChangeError, Register,
@@ -10,7 +10,7 @@ where
I2C: embedded_hal::i2c::I2c<Error = E>,
CONV: conversion::ConvertMeasurement,
{
- /// Change operating mode to OneShot
+ /// Changes to one-shot operating mode.
pub fn into_one_shot(
mut self,
) -> Result<Ads1x1x<I2C, IC, CONV, mode::OneShot>, ModeChangeError<E, Self>> {
@@ -29,13 +29,13 @@ where
})
}
- /// Read the most recent measurement
+ /// Reads the most recent measurement.
pub fn read(&mut self) -> Result<i16, Error<E>> {
let value = self.read_register(Register::CONVERSION)?;
Ok(CONV::convert_measurement(value))
}
- /// Select the channel for measurements.
+ /// Selects the channel used for measurements.
///
/// Note that when changing the channel in continuous conversion mode, the
/// ongoing conversion will be completed.
diff --git a/src/devices/mode/mod.rs b/src/devices/mode/mod.rs
index 670ebe9..356c67a 100644
--- a/src/devices/mode/mod.rs
+++ b/src/devices/mode/mod.rs
@@ -1,4 +1,2 @@
-//! Functions for all devices specific to each operating mode
-
mod continuous;
mod oneshot;
diff --git a/src/devices/mode/oneshot.rs b/src/devices/mode/oneshot.rs
index 10cdadb..22b6d51 100644
--- a/src/devices/mode/oneshot.rs
+++ b/src/devices/mode/oneshot.rs
@@ -1,16 +1,18 @@
-//! Common functions
+//! One-shot measurement mode.
+
+use core::marker::PhantomData;
+
use crate::{
conversion, devices::OperatingMode, mode, Ads1x1x, BitFlags, ChannelId, Config, Error,
ModeChangeError, Register,
};
-use core::marker::PhantomData;
impl<I2C, IC, CONV, E> Ads1x1x<I2C, IC, CONV, mode::OneShot>
where
I2C: embedded_hal::i2c::I2c<Error = E>,
CONV: conversion::ConvertMeasurement,
{
- /// Change operating mode to Continuous
+ /// Changes to continuous operating mode.
pub fn into_continuous(
mut self,
) -> Result<Ads1x1x<I2C, IC, CONV, mode::Continuous>, ModeChangeError<E, Self>> {
@@ -40,13 +42,12 @@ where
I2C: embedded_hal::i2c::I2c<Error = E>,
CONV: conversion::ConvertMeasurement,
{
- /// Request that the ADC begin a conversion on the specified channel.
+ /// Requests that the ADC begins a conversion on the specified channel.
///
/// The output value will be within `[2047..-2048]` for 12-bit devices
/// (`ADS101x`) and within `[32767..-32768]` for 16-bit devices (`ADS111x`).
/// The voltage that these values correspond to must be calculated using
- /// the full-scale range selected.
- /// See [`FullScaleRange`](enum.FullScaleRange.html).
+ /// the full-scale range ([`FullScaleRange`](crate::FullScaleRange)) selected.
///
/// Returns `nb::Error::WouldBlock` while a measurement is in progress.
///