From 5485d9655e2ab3a6d04e5f69b246f5db4d2c5936 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Wed, 21 Nov 2018 09:35:37 +0100 Subject: Code formatting --- src/devices/mode/continuous.rs | 11 ++++++----- src/devices/mode/oneshot.rs | 15 ++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src/devices/mode') diff --git a/src/devices/mode/continuous.rs b/src/devices/mode/continuous.rs index 35cfd7b..cb4757c 100644 --- a/src/devices/mode/continuous.rs +++ b/src/devices/mode/continuous.rs @@ -1,9 +1,9 @@ //! Continuous measurement mode -use core::marker::PhantomData; -use { Ads1x1x, conversion, Error, hal, interface, mode, Register }; -use channels::ChannelSelection; use super::super::OperatingMode; +use channels::ChannelSelection; +use core::marker::PhantomData; +use {conversion, hal, interface, mode, Ads1x1x, Error, Register}; impl Ads1x1x where @@ -20,7 +20,7 @@ where a_conversion_was_started: false, _conv: PhantomData, _ic: PhantomData, - _mode: PhantomData + _mode: PhantomData, }) } @@ -58,7 +58,8 @@ where /// Select the channel for measurements. pub fn select_channel(&mut self, _channel: &mut CH) -> Result<(), Error> where - CH: hal::adc::Channel, ID = ChannelSelection> { + CH: hal::adc::Channel, ID = ChannelSelection>, + { let config = self.config.with_mux_bits(CH::channel()); self.iface.write_register(Register::CONFIG, config.bits)?; self.config = config; diff --git a/src/devices/mode/oneshot.rs b/src/devices/mode/oneshot.rs index a03d8d2..3595c26 100644 --- a/src/devices/mode/oneshot.rs +++ b/src/devices/mode/oneshot.rs @@ -1,14 +1,14 @@ //! Common functions -use core::marker::PhantomData; -use { Ads1x1x, mode, Error, Register, BitFlags, Config }; -use { interface, conversion, hal, nb }; use channels::ChannelSelection; +use core::marker::PhantomData; +use {conversion, hal, interface, nb}; +use {mode, Ads1x1x, BitFlags, Config, Error, Register}; impl Ads1x1x where DI: interface::WriteData + interface::ReadData, - CONV: conversion::ConvertMeasurement + CONV: conversion::ConvertMeasurement, { /// Change operating mode to Continuous pub fn into_continuous(self) -> Result, Error> { @@ -19,7 +19,7 @@ where a_conversion_was_started: self.a_conversion_was_started, _conv: PhantomData, _ic: PhantomData, - _mode: PhantomData + _mode: PhantomData, }) } @@ -34,7 +34,7 @@ impl hal::adc::OneShot where DI: interface::ReadData + interface::WriteData, CONV: conversion::ConvertMeasurement, - CH: hal::adc::Channel, ID = ChannelSelection> + CH: hal::adc::Channel, ID = ChannelSelection>, { type Error = Error; @@ -63,7 +63,8 @@ where return Ok(CONV::convert_measurement(value)); } let config = self.config.with_mux_bits(CH::channel()); - self.trigger_measurement(&config).map_err(nb::Error::Other)?; + self.trigger_measurement(&config) + .map_err(nb::Error::Other)?; self.config = config; self.a_conversion_was_started = true; Err(nb::Error::WouldBlock) -- cgit v1.2.3-54-g00ecf