summaryrefslogtreecommitdiffstats
path: root/src/devices/mode/continuous.rs
blob: e90b1ae64ad83de5c33e40ce024931082804e1f9 (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 };
use super::super::OperatingMode;

impl<DI, IC, CONV, E> Ads1x1x<DI, IC, CONV, mode::Continuous>
where
    DI: interface::WriteData<Error = E>,
{
    /// Change operating mode to OneShot
    pub fn into_one_shot(mut self) -> Result<Ads1x1x<DI, IC, CONV, 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,
            _conv: PhantomData,
            _ic: PhantomData,
            _mode: PhantomData
        })
    }
}