diff options
Diffstat (limited to 'src/devices/mode')
-rw-r--r-- | src/devices/mode/mod.rs | 2 | ||||
-rw-r--r-- | src/devices/mode/oneshot.rs | 10 |
2 files changed, 9 insertions, 3 deletions
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)); } |