summaryrefslogtreecommitdiffstats
path: root/src/devices
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-08 19:01:40 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-08 19:01:40 +0100
commitdbecb1c3af672b06e7443134e1efc7f5050e99ff (patch)
treed84cd91660f86bbf22646a0f831be49c77529d51 /src/devices
parent0a9652fe9c079a6bb3829d74c31a14ec7b34affe (diff)
downloadads1x1x-async-dbecb1c3af672b06e7443134e1efc7f5050e99ff.tar.gz
ads1x1x-async-dbecb1c3af672b06e7443134e1efc7f5050e99ff.tar.xz
ads1x1x-async-dbecb1c3af672b06e7443134e1efc7f5050e99ff.zip
Enforce IC type to contain a resolution
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/ads1x1x/mode/continuous.rs5
-rw-r--r--src/devices/ads1x1x/mode/oneshot.rs3
2 files changed, 5 insertions, 3 deletions
diff --git a/src/devices/ads1x1x/mode/continuous.rs b/src/devices/ads1x1x/mode/continuous.rs
index 1532b62..1472478 100644
--- a/src/devices/ads1x1x/mode/continuous.rs
+++ b/src/devices/ads1x1x/mode/continuous.rs
@@ -1,12 +1,13 @@
//! Common functions
use core::marker::PhantomData;
-use { Ads1x1x, mode, Error, interface };
+use { Ads1x1x, mode, Error, interface, ic };
use super::super::OperatingMode;
impl<DI, IC, E> Ads1x1x<DI, IC, mode::Continuous>
where
- DI: interface::WriteData<Error = E>
+ DI: interface::WriteData<Error = E>,
+ IC: ic::Resolution
{
/// Change operating mode to OneShot
pub fn into_one_shot(mut self) -> Result<Ads1x1x<DI, IC, mode::OneShot>, Error<E>> {
diff --git a/src/devices/ads1x1x/mode/oneshot.rs b/src/devices/ads1x1x/mode/oneshot.rs
index cc36f89..554a55e 100644
--- a/src/devices/ads1x1x/mode/oneshot.rs
+++ b/src/devices/ads1x1x/mode/oneshot.rs
@@ -8,7 +8,8 @@ use super::convert_measurement;
impl<DI, IC, E> Ads1x1x<DI, IC, mode::OneShot>
where
- DI: interface::WriteData<Error = E> + interface::ReadData<Error = E>
+ DI: interface::WriteData<Error = E> + interface::ReadData<Error = E>,
+ IC: ic::Resolution
{
/// Change operating mode to Continuous
pub fn into_continuous(mut self) -> Result<Ads1x1x<DI, IC, mode::Continuous>, Error<E>> {