pub enum Attenuation {
    Attenuation0dB,
    Attenuation2p5dB,
    Attenuation6dB,
    Attenuation11dB,
}
Expand description

The attenuation of the ADC pin

Variants§

§

Attenuation0dB

0 dB attenuation, measurement range: 0 - 800 mV

§

Attenuation2p5dB

2.5 dB attenuation, measurement range: 0 - 1100 mV

§

Attenuation6dB

6 dB attenuation, measurement range: 0 - 1350 mV

§

Attenuation11dB

11 dB attenuation, measurement range: 0 - 2600 mV

Implementations§

source§

impl Attenuation

source

pub const ALL: &'static [Attenuation] = &[Attenuation::Attenuation0dB, Attenuation::Attenuation2p5dB, Attenuation::Attenuation6dB, Attenuation::Attenuation11dB]

List of all supported attenuations

source

pub const fn ref_mv(&self) -> u16

Reference voltage in millivolts

Vref = 10 ^ (Att / 20) * Vref0 where Vref0 = 1.1 V, Att - attenuation in dB

To colvert raw value to millivolts use folmula: V = D * Vref / 2 ^ R where D - raw ADC value, R - resolution in bits

Trait Implementations§

source§

impl Clone for Attenuation

source§

fn clone(&self) -> Attenuation

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl PartialEq<Attenuation> for Attenuation

source§

fn eq(&self, other: &Attenuation) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Attenuation

source§

impl Eq for Attenuation

source§

impl StructuralEq for Attenuation

source§

impl StructuralPartialEq for Attenuation

Auto Trait Implementations§

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, 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.