//! Tier 2 features. //! //! These are the features included only in ADS1x14, ADS1x15 use { Ads1x1x, Error, interface, ic, ComparatorMode, ComparatorPolarity, Register, BitFlags }; impl Ads1x1x where DI: interface::WriteData, IC: ic::Resolution + ic::Tier2Features { /// Set comparator mode pub fn set_comparator_mode(&mut self, mode: ComparatorMode) -> Result<(), Error> { 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> { 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(()) } }