[][src]Struct avr_hal_generic::adc::Adc

pub struct Adc<H, ADC: AdcOps<H>, CLOCK> { /* fields omitted */ }

Analog-to-Digital Converter

let dp = atmega_hal::Peripherals::take().unwrap();
let pins = atmega_hal::pins!(dp);
let mut adc = atmega_hal::Adc::new(dp.ADC, Default::default());

let a0 = dp.pc0.into_analog_input(&mut adc);

// the following two calls are equivalent
let voltage = a0.analog_read(&mut adc);
let voltage = adc.read_blocking(&a0);

// alternatively, a non-blocking interface exists
let voltage = nb::block!(adc.read_nonblocking(&a0)).void_unwrap();


impl<H, ADC, CLOCK> Adc<H, ADC, CLOCK> where
    ADC: AdcOps<H>,
    CLOCK: Clock

pub fn new(p: ADC, settings: ADC::Settings) -> Self[src]

pub fn initialize(&mut self, settings: ADC::Settings)[src]

pub fn read_blocking<PIN: AdcChannel<H, ADC>>(&mut self, pin: &PIN) -> u16[src]

pub fn read_nonblocking<PIN: AdcChannel<H, ADC>>(
    &mut self,
    pin: &PIN
) -> Result<u16, Void>

Auto Trait Implementations

impl<H, ADC, CLOCK> Send for Adc<H, ADC, CLOCK> where
    ADC: Send,
    CLOCK: Send,
    H: Send,
    <ADC as AdcOps<H>>::Channel: Send

impl<H, ADC, CLOCK> Sync for Adc<H, ADC, CLOCK> where
    ADC: Sync,
    CLOCK: Sync,
    H: Sync,
    <ADC as AdcOps<H>>::Channel: Sync

impl<H, ADC, CLOCK> Unpin for Adc<H, ADC, CLOCK> where
    ADC: Unpin,
    CLOCK: Unpin,
    H: Unpin,
    <ADC as AdcOps<H>>::Channel: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.