summaryrefslogtreecommitdiffstats
path: root/src/devices/mode/oneshot.rs
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2019-03-30 13:36:06 +0200
committerDiego Barrios Romero <eldruin@gmail.com>2019-03-31 13:41:26 +0200
commit50223ad02e2f487540107e320c8bef40a9849582 (patch)
tree58b4e44e2261940d07aba96b8d8e83457e641f53 /src/devices/mode/oneshot.rs
parentab1221e175f2da577c7a3fb510b5ae5cf41b0697 (diff)
downloadads1x1x-async-50223ad02e2f487540107e320c8bef40a9849582.tar.gz
ads1x1x-async-50223ad02e2f487540107e320c8bef40a9849582.tar.xz
ads1x1x-async-50223ad02e2f487540107e320c8bef40a9849582.zip
Format code
Diffstat (limited to 'src/devices/mode/oneshot.rs')
-rw-r--r--src/devices/mode/oneshot.rs10
1 files changed, 8 insertions, 2 deletions
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));
}