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
type Channel
The chip-dependent type of an ADC channel.
Required Methods
fn initialize(&self) -> ReturnCode
Initialize must be called before taking a sample.
fn sample(&self, channel: &Self::Channel) -> ReturnCode
Request a single ADC sample on a particular channel. Used for individual samples that have no timing requirements.
fn sample_continuous(
&self,
channel: &Self::Channel,
frequency: u32
) -> ReturnCode
&self,
channel: &Self::Channel,
frequency: u32
) -> ReturnCode
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.
fn stop_sampling(&self) -> ReturnCode
Stop a sampling operation. Can be used to stop any simple or high-speed sampling operation. No further callbacks will occur.