summaryrefslogtreecommitdiffstats
path: root/src/devices
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2020-06-21 22:52:41 +0200
committerDiego Barrios Romero <eldruin@gmail.com>2020-06-21 22:52:41 +0200
commit6aed921780dbe12c058e0aa0ce8b617e404b5a87 (patch)
tree3b76c4d8946aede3e48fcfade62a2e19488ee118 /src/devices
parentb7e9c9acf1bb42f4966930354135782bab57394a (diff)
downloadads1x1x-async-6aed921780dbe12c058e0aa0ce8b617e404b5a87.tar.gz
ads1x1x-async-6aed921780dbe12c058e0aa0ce8b617e404b5a87.tar.xz
ads1x1x-async-6aed921780dbe12c058e0aa0ce8b617e404b5a87.zip
Use edition 2018
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/common.rs3
-rw-r--r--src/devices/features/tier1.rs8
-rw-r--r--src/devices/features/tier2.rs4
-rw-r--r--src/devices/mode/continuous.rs7
-rw-r--r--src/devices/mode/oneshot.rs15
5 files changed, 20 insertions, 17 deletions
diff --git a/src/devices/common.rs b/src/devices/common.rs
index 57d67b9..2234d93 100644
--- a/src/devices/common.rs
+++ b/src/devices/common.rs
@@ -1,7 +1,6 @@
//! Common functions
-use super::OperatingMode;
-use {interface, Ads1x1x, BitFlags, Config, Error, Register};
+use crate::{devices::OperatingMode, interface, Ads1x1x, BitFlags, Config, Error, Register};
impl<DI, IC, CONV, MODE, E> Ads1x1x<DI, IC, CONV, MODE>
where
diff --git a/src/devices/features/tier1.rs b/src/devices/features/tier1.rs
index 9e5cb77..0c940ee 100644
--- a/src/devices/features/tier1.rs
+++ b/src/devices/features/tier1.rs
@@ -1,6 +1,8 @@
//! Common functions
-use {ic, interface, Ads1x1x, BitFlags as BF, DataRate12Bit, DataRate16Bit, Error, Register};
+use crate::{
+ ic, interface, Ads1x1x, BitFlags as BF, DataRate12Bit, DataRate16Bit, Error, Register,
+};
impl<DI, IC, MODE, E> Ads1x1x<DI, IC, ic::Resolution12Bit, MODE>
where
@@ -8,7 +10,7 @@ where
{
/// Set data rate
pub fn set_data_rate(&mut self, rate: DataRate12Bit) -> Result<(), Error<E>> {
- use DataRate12Bit as DR;
+ use crate::DataRate12Bit as DR;
let cfg = self.config.clone();
let config = match rate {
DR::Sps128 => cfg.with_low(BF::DR2).with_low(BF::DR1).with_low(BF::DR0),
@@ -31,7 +33,7 @@ where
{
/// Set data rate
pub fn set_data_rate(&mut self, rate: DataRate16Bit) -> Result<(), Error<E>> {
- use DataRate16Bit as DR;
+ use crate::DataRate16Bit as DR;
let cfg = self.config.clone();
let config = match rate {
DR::Sps8 => cfg.with_low(BF::DR2).with_low(BF::DR1).with_low(BF::DR0),
diff --git a/src/devices/features/tier2.rs b/src/devices/features/tier2.rs
index 0b0b92c..96330a0 100644
--- a/src/devices/features/tier2.rs
+++ b/src/devices/features/tier2.rs
@@ -2,7 +2,7 @@
//!
//! These are the features included only in ADS1x14, ADS1x15
-use {
+use crate::{
conversion, ic, interface, Ads1x1x, BitFlags as BF, ComparatorLatching, ComparatorMode,
ComparatorPolarity, ComparatorQueue, Error, FullScaleRange, Register,
};
@@ -17,7 +17,7 @@ where
///
/// This configures the programmable gain amplifier and determines the measurable input voltage range.
pub fn set_full_scale_range(&mut self, range: FullScaleRange) -> Result<(), Error<E>> {
- use FullScaleRange as FSR;
+ use crate::FullScaleRange as FSR;
let cfg = self.config.clone();
let config = match range {
FSR::Within6_144V => cfg.with_low(BF::PGA2).with_low(BF::PGA1).with_low(BF::PGA0),
diff --git a/src/devices/mode/continuous.rs b/src/devices/mode/continuous.rs
index 29471de..d2955aa 100644
--- a/src/devices/mode/continuous.rs
+++ b/src/devices/mode/continuous.rs
@@ -1,9 +1,10 @@
//! Continuous measurement mode
-use super::super::OperatingMode;
-use channels::ChannelSelection;
+use crate::{
+ channels::ChannelSelection, conversion, devices::OperatingMode, hal, interface, mode, Ads1x1x,
+ Error, ModeChangeError, Register,
+};
use core::marker::PhantomData;
-use {conversion, hal, interface, mode, Ads1x1x, Error, ModeChangeError, Register};
impl<DI, IC, CONV, E> Ads1x1x<DI, IC, CONV, mode::Continuous>
where
diff --git a/src/devices/mode/oneshot.rs b/src/devices/mode/oneshot.rs
index 5901292..579c2fb 100644
--- a/src/devices/mode/oneshot.rs
+++ b/src/devices/mode/oneshot.rs
@@ -1,10 +1,11 @@
//! Common functions
-
-use super::super::OperatingMode;
-use channels::ChannelSelection;
+use crate::{
+ channels::ChannelSelection, conversion, devices::OperatingMode, interface, mode, Ads1x1x,
+ BitFlags, Config, Error, ModeChangeError, Register,
+};
use core::marker::PhantomData;
-use {conversion, hal, interface, nb};
-use {mode, Ads1x1x, BitFlags, Config, Error, ModeChangeError, Register};
+use embedded_hal::adc;
+use nb;
impl<DI, IC, CONV, E> Ads1x1x<DI, IC, CONV, mode::OneShot>
where
@@ -35,12 +36,12 @@ where
}
}
-impl<DI, IC, CONV, E, CH> hal::adc::OneShot<Ads1x1x<DI, IC, CONV, mode::OneShot>, i16, CH>
+impl<DI, IC, CONV, E, CH> adc::OneShot<Ads1x1x<DI, IC, CONV, mode::OneShot>, i16, CH>
for Ads1x1x<DI, IC, CONV, mode::OneShot>
where
DI: interface::ReadData<Error = E> + interface::WriteData<Error = E>,
CONV: conversion::ConvertMeasurement,
- CH: hal::adc::Channel<Ads1x1x<DI, IC, CONV, mode::OneShot>, ID = ChannelSelection>,
+ CH: adc::Channel<Ads1x1x<DI, IC, CONV, mode::OneShot>, ID = ChannelSelection>,
{
type Error = Error<E>;