From 3e3a790d9f70bfd6cb4210dfe09560d0385fdf5a Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Sun, 11 Nov 2018 08:04:42 +0100 Subject: Reorganize modules --- src/devices/mode/continuous.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/devices/mode/continuous.rs (limited to 'src/devices/mode/continuous.rs') diff --git a/src/devices/mode/continuous.rs b/src/devices/mode/continuous.rs new file mode 100644 index 0000000..1472478 --- /dev/null +++ b/src/devices/mode/continuous.rs @@ -0,0 +1,23 @@ +//! Common functions + +use core::marker::PhantomData; +use { Ads1x1x, mode, Error, interface, ic }; +use super::super::OperatingMode; + +impl Ads1x1x +where + DI: interface::WriteData, + IC: ic::Resolution +{ + /// Change operating mode to OneShot + pub fn into_one_shot(mut self) -> Result, Error> { + self.set_operating_mode(OperatingMode::OneShot)?; + Ok(Ads1x1x { + iface: self.iface, + config: self.config, + a_conversion_was_started: self.a_conversion_was_started, + _ic: PhantomData, + _mode: PhantomData + }) + } +} -- cgit v1.2.3-54-g00ecf