Trait attiny_hal::adc::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);
}
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.

Object Safety§

This trait is not object safe.

Implementors§