Struct atsamd_hal::adc::Adc

source ·
pub struct Adc<ADC> { /* private fields */ }
Expand description

Adc encapsulates the device ADC

Implementations§

source§

impl Adc<ADC>

source

pub fn adc(adc: ADC, pm: &mut PM, clocks: &mut GenericClockController) -> Self

Create a new Adc instance. The default configuration is:

  • 1/32 prescaler
  • 12 bit resolution
  • 1 sample
  • 1/2 gain
  • 1/2 VDDANA reference voltage
source

pub fn samples(&mut self, samples: SampleRate)

Set the sample rate

source

pub fn gain(&mut self, gain: Gain)

Set the gain factor

source

pub fn reference(&mut self, reference: Reference)

Set the voltage reference

source

pub fn prescaler(&mut self, prescaler: Prescaler)

Set the prescaler for adjusting the clock relative to the system clock

source

pub fn resolution(&mut self, resolution: Resolution)

Set the input resolution.

Trait Implementations§

source§

impl<WORD, PIN> OneShot<ADC, WORD, PIN> for Adc<ADC>where WORD: From<u16>, PIN: Channel<ADC, ID = u8>,

§

type Error = ()

Error type returned by ADC methods
source§

fn read(&mut self, _pin: &mut PIN) -> Result<WORD, Self::Error>

Request that the ADC begin a conversion on the specified pin Read more

Auto Trait Implementations§

§

impl<ADC> RefUnwindSafe for Adc<ADC>where ADC: RefUnwindSafe,

§

impl<ADC> Send for Adc<ADC>where ADC: Send,

§

impl<ADC> Sync for Adc<ADC>where ADC: Sync,

§

impl<ADC> Unpin for Adc<ADC>where ADC: Unpin,

§

impl<ADC> UnwindSafe for Adc<ADC>where ADC: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.