Skip to main content

Adc

Enum Adc 

Source
pub enum Adc {
    Bits9,
    Bits10,
    Bits11,
    Bits12,
    Samples2,
    Samples4,
    Samples8,
    Samples16,
    Samples32,
    Samples64,
    Samples128,
}
Expand description

An ADC resolution or averaging setting, for the BADC and SADC fields.

The four-bit code selects either a resolution, when its high bit is clear, or a sample count averaged at 12 bits, when it is set. Each setting has the conversion time the datasheet tabulates.

Variants§

§

Bits9

9-bit, 84 us.

§

Bits10

10-bit, 148 us.

§

Bits11

11-bit, 276 us.

§

Bits12

12-bit, 532 us, the reset setting.

§

Samples2

2 samples averaged, 1.06 ms.

§

Samples4

4 samples averaged, 2.13 ms.

§

Samples8

8 samples averaged, 4.26 ms.

§

Samples16

16 samples averaged, 8.51 ms.

§

Samples32

32 samples averaged, 17.02 ms.

§

Samples64

64 samples averaged, 34.05 ms.

§

Samples128

128 samples averaged, 68.10 ms.

Implementations§

Source§

impl Adc

Source

pub fn code(self) -> u8

Returns the four-bit field value.

Source

pub fn from_code(code: u8) -> Adc

Decodes a four-bit field value.

With the high bit clear the second bit is ignored and the low two select the resolution; 0b1000 is 12-bit as well.

§Arguments
  • code - the field value; only the low four bits are used.
§Returns

The setting.

Source

pub fn conversion_micros(self) -> u32

Returns the conversion time in microseconds.

Trait Implementations§

Source§

impl Clone for Adc

Source§

fn clone(&self) -> Adc

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Adc

Source§

impl Debug for Adc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Adc

Source§

fn default() -> Adc

Returns the “default value” for a type. Read more
Source§

impl Eq for Adc

Source§

impl PartialEq for Adc

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Adc

Auto Trait Implementations§

§

impl Freeze for Adc

§

impl RefUnwindSafe for Adc

§

impl Send for Adc

§

impl Sync for Adc

§

impl Unpin for Adc

§

impl UnsafeUnpin for Adc

§

impl UnwindSafe for Adc

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.