summaryrefslogtreecommitdiffstats
path: root/src/devices/ads1x1x/mode/continuous.rs
blob: 1472478ee88d05109a7f5ba81d91b6b9dd8a9fbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! Common functions

use core::marker::PhantomData;
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>,
    IC: ic::Resolution
{
    /// Change operating mode to OneShot
    pub fn into_one_shot(mut self) -> Result<Ads1x1x<DI, IC, mode::OneShot>, Error<E>> {
        self.set_operating_mode(OperatingMode::OneShot)?;
        Ok(Ads1x1x {
            iface: self.iface,
            config: self.config,
            a_conversion_was_started: self.a_conversion_was_started,
            _ic: PhantomData,
            _mode: PhantomData
        })
    }
}