diff options
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/features/tier2.rs | 12 | ||||
-rw-r--r-- | src/devices/mod.rs | 4 | ||||
-rw-r--r-- | src/devices/mode/mod.rs | 2 | ||||
-rw-r--r-- | src/devices/mode/oneshot.rs | 10 |
4 files changed, 21 insertions, 7 deletions
diff --git a/src/devices/features/tier2.rs b/src/devices/features/tier2.rs index 48e4eb9..0b0b92c 100644 --- a/src/devices/features/tier2.rs +++ b/src/devices/features/tier2.rs @@ -128,7 +128,10 @@ where /// The comparator can be enabled by setting the comparator queue. /// See [`set_comparator_queue()`](struct.Ads1x1x.html#method.set_comparator_queue) pub fn disable_comparator(&mut self) -> Result<(), Error<E>> { - let config = self.config.with_high(BF::COMP_QUE1).with_high(BF::COMP_QUE0); + let config = self + .config + .with_high(BF::COMP_QUE1) + .with_high(BF::COMP_QUE0); self.iface.write_register(Register::CONFIG, config.bits)?; self.config = config; Ok(()) @@ -142,7 +145,12 @@ where /// /// When calling this the comparator will be disabled and the thresholds will be cleared. pub fn use_alert_rdy_pin_as_ready(&mut self) -> Result<(), Error<E>> { - if self.config != self.config.with_high(BF::COMP_QUE1).with_high(BF::COMP_QUE0) { + if self.config + != self + .config + .with_high(BF::COMP_QUE1) + .with_high(BF::COMP_QUE0) + { self.disable_comparator()?; } self.iface.write_register(Register::HIGH_TH, 0x8000)?; diff --git a/src/devices/mod.rs b/src/devices/mod.rs index 5b87738..01efeba 100644 --- a/src/devices/mod.rs +++ b/src/devices/mod.rs @@ -4,6 +4,6 @@ enum OperatingMode { Continuous, } -mod mode; -mod features; mod common; +mod features; +mod mode; diff --git a/src/devices/mode/mod.rs b/src/devices/mode/mod.rs index 9625465..670ebe9 100644 --- a/src/devices/mode/mod.rs +++ b/src/devices/mode/mod.rs @@ -1,4 +1,4 @@ //! Functions for all devices specific to each operating mode -mod oneshot; mod continuous; +mod oneshot; diff --git a/src/devices/mode/oneshot.rs b/src/devices/mode/oneshot.rs index 612d5a4..5901292 100644 --- a/src/devices/mode/oneshot.rs +++ b/src/devices/mode/oneshot.rs @@ -58,13 +58,19 @@ where /// measurement on a different channel is requested, a new measurement on /// using the new channel selection is triggered. fn read(&mut self, _channel: &mut CH) -> nb::Result<i16, Self::Error> { - if self.is_measurement_in_progress().map_err(nb::Error::Other)? { + if self + .is_measurement_in_progress() + .map_err(nb::Error::Other)? + { return Err(nb::Error::WouldBlock); } let same_channel = self.config == self.config.with_mux_bits(CH::channel()); if self.a_conversion_was_started && same_channel { // result is ready - let value = self.iface.read_register(Register::CONVERSION).map_err(nb::Error::Other)?; + let value = self + .iface + .read_register(Register::CONVERSION) + .map_err(nb::Error::Other)?; self.a_conversion_was_started = false; return Ok(CONV::convert_measurement(value)); } |