Enum ConversionMode

Source
#[non_exhaustive]
pub enum ConversionMode { Single, Continuous, Discontinuous(u8), }
Expand description

The conversion mode the ADC peripheral is operating in.

The Adc can be configured through Adc::set_conversion_mode and obtained via Adc::conversion_mode.

A conversion is either started by Adc::start_conversion, or by an external trigger (ExternalTrigger).

§TLDR

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Single

In Single conversion mode, the ADC performs once all the conversions of the channels.

§Start Conditions

Inside the regular sequence, after each conversion is complete:

After the regular sequence is complete:

§

Continuous

In continuous conversion mode, when a software or hardware regular trigger event occurs, the ADC performs once all the regular conversions of the channels and then automatically re-starts and continuously converts each conversions of the sequence.

§Note

This mode applies to regular channls only.

§Start conditions

Inside the regular sequence, after each conversion is complete:

After the sequence of conversions is complete:

§

Discontinuous(u8)

It is used to convert a short sequence (sub-group) of n + 1 conversions (n ≤ 8) that is part of the sequence of conversions selected via Adc::set_channel_sequence. The value is specified by the associated enum value Discontinuous(n).

When an ExternalTrigger occurs, it starts the next n + 1 conversions selected with Adc::set_channel_sequence registers until all the conversions in the sequence are done. The total sequence length is defined by Adc::set_sequence_length

§Example

§Discontinuous(2)

Channels to be converted = 1, 2, 3, 6, 7, 8, 9, 10, 11

§Continuous

Channels to be converted = 1, 2, 3, 6, 7, 8, 9, 10,11

  • 1st trigger:
    • The complete sequence is converted: channel 1, then 2, 3, 6, 7, 9, 10 and 11. Each conversion generates an Event::EndOfConversion event and the last one also generates an Event::EndOfSequence event. – All the next trigger events will relaunch the complete sequence

§Note

When a regular group is converted in ConversionMode::Discontinuous, no rollover occurs (the last subgroup of the sequence can have less than n conversions). When all subgroups are converted, the next trigger starts the conversion of the first subgroup. In the example above, the 4th trigger reconverts the channels 1, 2 and 3 in the 1st subgroup.

Trait Implementations§

Source§

impl Clone for ConversionMode

Source§

fn clone(&self) -> ConversionMode

Returns a duplicate 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 Debug for ConversionMode

Source§

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

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

impl Default for ConversionMode

Source§

fn default() -> Self

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

impl From<CONT_A> for ConversionMode

Source§

fn from(mode: CONT_A) -> Self

Converts to this type from the input type.
Source§

impl From<ConversionMode> for CONT_A

Source§

fn from(mode: ConversionMode) -> Self

Converts to this type from the input type.
Source§

impl From<ConversionMode> for DISCEN_A

Source§

fn from(mode: ConversionMode) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ConversionMode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ConversionMode

Source§

impl Eq for ConversionMode

Source§

impl StructuralPartialEq for ConversionMode

Auto Trait Implementations§

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