Skip to main content

AdcOps

Trait AdcOps 

Source
pub trait AdcOps<H> {
    type Channel: PartialEq + Copy;
    type Settings: PartialEq + Copy;

    // Required methods
    fn raw_init(&mut self, settings: Self::Settings);
    fn raw_read_adc(&self) -> u16;
    fn raw_is_converting(&self) -> bool;
    fn raw_start_conversion(&mut self);
    fn raw_set_channel(&mut self, channel: Self::Channel);
    fn raw_enable_channel(&mut self, channel: Self::Channel);
    fn raw_disable_channel(&mut self, channel: Self::Channel);
}
Available on crate feature mcu-atmega only.
Expand description

Internal trait for the low-level ADC peripheral.

Prefer using the Adc API instead of this trait.

Required Associated Types§

Source

type Channel: PartialEq + Copy

Channel ID type for this ADC.

Source

type Settings: PartialEq + Copy

Settings type for this ADC.

Required Methods§

Source

fn raw_init(&mut self, settings: Self::Settings)

Initialize the ADC peripheral with the specified settings.

Warning: This is a low-level method and should not be called directly from user code.

Source

fn raw_read_adc(&self) -> u16

Read out the ADC data register.

This method must only be called after a conversion completed.

Warning: This is a low-level method and should not be called directly from user code.

Source

fn raw_is_converting(&self) -> bool

Check whether the ADC is currently converting a signal.

Warning: This is a low-level method and should not be called directly from user code.

Source

fn raw_start_conversion(&mut self)

Start a conversion on the currently selected channel.

Warning: This is a low-level method and should not be called directly from user code.

Source

fn raw_set_channel(&mut self, channel: Self::Channel)

Set the multiplexer to a certain channel.

Warning: This is a low-level method and should not be called directly from user code.

Source

fn raw_enable_channel(&mut self, channel: Self::Channel)

Set the DIDR (Digital Input Disable) for a certain channel.

This disabled digital logic on the corresponding pin and allows measuring analog signals.

Warning: This is a low-level method and should not be called directly from user code.

Source

fn raw_disable_channel(&mut self, channel: Self::Channel)

Clear the DIDR (Digital Input Disable) for a certain channel.

Enables digital logic on the corresponding pin after it has been used as an ADC channel.

Warning: This is a low-level method and should not be called directly from user code.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AdcOps<Atmega> for Periph<RegisterBlock, 120>

Implementors§