From 5cd361340635aafe8806c82805622bc6afc4c4d7 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 19 Jan 2024 15:09:19 +0100 Subject: Remove `I2cInterface`. (#20) * Merge `ReadData` and `WriteData` traits. * Remove `I2cInterface`. * Update changelog. * Fix links. --- src/devices/features/tier1.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/devices/features/tier1.rs') diff --git a/src/devices/features/tier1.rs b/src/devices/features/tier1.rs index 0c940ee..c6aa8cd 100644 --- a/src/devices/features/tier1.rs +++ b/src/devices/features/tier1.rs @@ -1,12 +1,10 @@ //! Common functions -use crate::{ - ic, interface, Ads1x1x, BitFlags as BF, DataRate12Bit, DataRate16Bit, Error, Register, -}; +use crate::{ic, Ads1x1x, BitFlags as BF, DataRate12Bit, DataRate16Bit, Error, Register}; -impl Ads1x1x +impl Ads1x1x where - DI: interface::WriteData, + I2C: embedded_hal::i2c::I2c, { /// Set data rate pub fn set_data_rate(&mut self, rate: DataRate12Bit) -> Result<(), Error> { @@ -21,15 +19,15 @@ where DR::Sps2400 => cfg.with_high(BF::DR2).with_low(BF::DR1).with_high(BF::DR0), DR::Sps3300 => cfg.with_high(BF::DR2).with_high(BF::DR1).with_low(BF::DR0), }; - self.iface.write_register(Register::CONFIG, config.bits)?; + self.write_register(Register::CONFIG, config.bits)?; self.config = config; Ok(()) } } -impl Ads1x1x +impl Ads1x1x where - DI: interface::WriteData, + I2C: embedded_hal::i2c::I2c, { /// Set data rate pub fn set_data_rate(&mut self, rate: DataRate16Bit) -> Result<(), Error> { @@ -45,7 +43,7 @@ where DR::Sps475 => cfg.with_high(BF::DR2).with_high(BF::DR1).with_low(BF::DR0), DR::Sps860 => cfg.with_high(BF::DR2).with_high(BF::DR1).with_high(BF::DR0), }; - self.iface.write_register(Register::CONFIG, config.bits)?; + self.write_register(Register::CONFIG, config.bits)?; self.config = config; Ok(()) } -- cgit v1.2.3-54-g00ecf