[][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();

Implementations

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

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>
[src]

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
[src]

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

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

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.