diff options
Diffstat (limited to 'src/devices/ads1x1x/mode/continuous.rs')
-rw-r--r-- | src/devices/ads1x1x/mode/continuous.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/devices/ads1x1x/mode/continuous.rs b/src/devices/ads1x1x/mode/continuous.rs new file mode 100644 index 0000000..1532b62 --- /dev/null +++ b/src/devices/ads1x1x/mode/continuous.rs @@ -0,0 +1,22 @@ +//! Common functions + +use core::marker::PhantomData; +use { Ads1x1x, mode, Error, interface }; +use super::super::OperatingMode; + +impl<DI, IC, E> Ads1x1x<DI, IC, mode::Continuous> +where + DI: interface::WriteData<Error = E> +{ + /// Change operating mode to OneShot + pub fn into_one_shot(mut self) -> Result<Ads1x1x<DI, IC, mode::OneShot>, Error<E>> { + 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 + }) + } +} |