From ea48b456d5045cd136c08829d40708eef1cab67a Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Tue, 20 Nov 2018 18:45:32 +0100 Subject: Add method to start continuous conversions --- src/devices/mode/continuous.rs | 7 +++++++ src/devices/mode/oneshot.rs | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/devices') diff --git a/src/devices/mode/continuous.rs b/src/devices/mode/continuous.rs index cb62f8d..6bf5201 100644 --- a/src/devices/mode/continuous.rs +++ b/src/devices/mode/continuous.rs @@ -21,4 +21,11 @@ where _mode: PhantomData }) } + + /// Start continuous conversions + pub fn start(&mut self) -> Result<(), Error> { + self.set_operating_mode(OperatingMode::Continuous)?; + self.a_conversion_was_started = true; + Ok(()) + } } diff --git a/src/devices/mode/oneshot.rs b/src/devices/mode/oneshot.rs index fc4a5ed..41a9f26 100644 --- a/src/devices/mode/oneshot.rs +++ b/src/devices/mode/oneshot.rs @@ -3,7 +3,6 @@ use core::marker::PhantomData; use { Ads1x1x, mode, Error, Register, BitFlags, Config }; use { interface, conversion, hal, nb }; -use devices::OperatingMode; use channels::ChannelSelection; impl Ads1x1x @@ -12,8 +11,7 @@ where CONV: conversion::ConvertMeasurement { /// Change operating mode to Continuous - pub fn into_continuous(mut self) -> Result, Error> { - self.set_operating_mode(OperatingMode::Continuous)?; + pub fn into_continuous(self) -> Result, Error> { Ok(Ads1x1x { iface: self.iface, config: self.config, -- cgit v1.2.3-54-g00ecf