summaryrefslogtreecommitdiffstats
path: root/src/devices/ads1x1x/features/tier2.rs
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-11 08:04:42 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-11 08:04:42 +0100
commit3e3a790d9f70bfd6cb4210dfe09560d0385fdf5a (patch)
tree8cf40e43cb93b15a774696c3af639d504addce8c /src/devices/ads1x1x/features/tier2.rs
parent8b9e9ecdb85a30ac1c57fe6b96498cae6ad9f7cc (diff)
downloadads1x1x-async-3e3a790d9f70bfd6cb4210dfe09560d0385fdf5a.tar.gz
ads1x1x-async-3e3a790d9f70bfd6cb4210dfe09560d0385fdf5a.tar.xz
ads1x1x-async-3e3a790d9f70bfd6cb4210dfe09560d0385fdf5a.zip
Reorganize modules
Diffstat (limited to 'src/devices/ads1x1x/features/tier2.rs')
-rw-r--r--src/devices/ads1x1x/features/tier2.rs48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/devices/ads1x1x/features/tier2.rs b/src/devices/ads1x1x/features/tier2.rs
deleted file mode 100644
index 43dce5c..0000000
--- a/src/devices/ads1x1x/features/tier2.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-//! Tier 2 features.
-//!
-//! These are the features included only in ADS1x14, ADS1x15
-
-use { Ads1x1x, Error, interface, ic, ComparatorMode, ComparatorPolarity,
- ComparatorLatching, Register, BitFlags };
-
-impl<DI, IC, MODE, E> Ads1x1x<DI, IC, MODE>
-where
- DI: interface::WriteData<Error = E>,
- IC: ic::Resolution + ic::Tier2Features
-{
- /// Set comparator mode
- pub fn set_comparator_mode(&mut self, mode: ComparatorMode) -> Result<(), Error<E>> {
- let config;
- match mode {
- ComparatorMode::Traditional => config = self.config.with_low(BitFlags::COMP_MODE),
- ComparatorMode::Window => config = self.config.with_high(BitFlags::COMP_MODE)
- }
- self.iface.write_register(Register::CONFIG, config.bits)?;
- self.config = config;
- Ok(())
- }
-
- /// Set comparator polarity
- pub fn set_comparator_polarity(&mut self, polarity: ComparatorPolarity) -> Result<(), Error<E>> {
- let config;
- match polarity {
- ComparatorPolarity::ActiveLow => config = self.config.with_low( BitFlags::COMP_POL),
- ComparatorPolarity::ActiveHigh => config = self.config.with_high(BitFlags::COMP_POL)
- }
- self.iface.write_register(Register::CONFIG, config.bits)?;
- self.config = config;
- Ok(())
- }
-
- /// Set comparator latching
- pub fn set_comparator_latching(&mut self, latching: ComparatorLatching) -> Result<(), Error<E>> {
- let config;
- match latching {
- ComparatorLatching::Nonlatching => config = self.config.with_low( BitFlags::COMP_LAT),
- ComparatorLatching::Latching => config = self.config.with_high(BitFlags::COMP_LAT)
- }
- self.iface.write_register(Register::CONFIG, config.bits)?;
- self.config = config;
- Ok(())
- }
-}