diff options
author | Diego Barrios Romero <eldruin@gmail.com> | 2019-03-30 13:36:06 +0200 |
---|---|---|
committer | Diego Barrios Romero <eldruin@gmail.com> | 2019-03-31 13:41:26 +0200 |
commit | 50223ad02e2f487540107e320c8bef40a9849582 (patch) | |
tree | 58b4e44e2261940d07aba96b8d8e83457e641f53 /src/devices/mode | |
parent | ab1221e175f2da577c7a3fb510b5ae5cf41b0697 (diff) | |
download | ads1x1x-async-50223ad02e2f487540107e320c8bef40a9849582.tar.gz ads1x1x-async-50223ad02e2f487540107e320c8bef40a9849582.tar.xz ads1x1x-async-50223ad02e2f487540107e320c8bef40a9849582.zip |
Format code
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)); } |