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/ads1x1x/common.rs | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 src/devices/ads1x1x/common.rs (limited to 'src/devices/ads1x1x/common.rs') diff --git a/src/devices/ads1x1x/common.rs b/src/devices/ads1x1x/common.rs deleted file mode 100644 index 5abb99c..0000000 --- a/src/devices/ads1x1x/common.rs +++ /dev/null @@ -1,36 +0,0 @@ -//! Common functions - -use { Ads1x1x, Error, Register, BitFlags, interface, Config, ic }; -use super::OperatingMode; - -impl Ads1x1x -where - DI: interface::WriteData, - IC: ic::Resolution -{ - pub(super) fn set_operating_mode(&mut self, mode: OperatingMode) -> Result<(), Error> { - let config; - match mode { - OperatingMode::OneShot => config = self.config.with_high(BitFlags::OP_MODE), - OperatingMode::Continuous => config = self.config.with_low(BitFlags::OP_MODE), - } - self.iface.write_register(Register::CONFIG, config.bits)?; - self.config = config; - Ok(()) - } - - /// Reset the internal state of this driver to the default values. - /// - /// *Note:* This does not alter the state or configuration of the device. - /// - /// This resets the cached configuration register value in this driver to - /// the power-up (reset) configuration of the device. - /// - /// This needs to be called after performing a reset on the device, for - /// example through an I2C general-call Reset command, which was not done - /// through this driver to ensure that the configurations in the device - /// and in the driver match. - pub fn reset_internal_driver_state(&mut self) { - self.config = Config::default(); - } -} -- cgit v1.2.3-54-g00ecf