Trait kernel::hil::adc::Adc [] [src]

pub trait Adc {
    type Channel;
    fn initialize(&self) -> ReturnCode;
fn sample(&self, channel: &Self::Channel) -> ReturnCode;
fn sample_continuous(
        &self,
        channel: &Self::Channel,
        frequency: u32
    ) -> ReturnCode;
fn stop_sampling(&self) -> ReturnCode; }

Simple interface for reading an ADC sample on any channel.

Associated Types

The chip-dependent type of an ADC channel.

Required Methods

Initialize must be called before taking a sample.

Request a single ADC sample on a particular channel. Used for individual samples that have no timing requirements.

Request repeated ADC samples on a particular channel. Callbacks will occur at the given frequency with low jitter and can be set to any frequency supported by the chip implementation. However callbacks may be limited based on how quickly the system can service individual samples, leading to missed samples at high frequencies.

Stop a sampling operation. Can be used to stop any simple or high-speed sampling operation. No further callbacks will occur.

Implementors