embassy-stm32

Crates

git

Versions

stm32l4p5re

Flavors

Skip to main content

Filter

Struct Filter 

Source
pub struct Filter<'tr, 'ti, 'a, 'd, T, M, D>{
    pub regular: FilterRegular<'a, 'd, 'tr, T, M, D>,
    pub injected: FilterInjected<'a, 'd, 'ti, T, M, D>,
    pub awd: AnalogWatchdog<'a, 'd, T, M>,
    pub extremes: ExtremesDetector<'a, 'd, T, M>,
    /* private fields */
}
Expand description

An enabled filter, split into its regular, injected, watchdog and extremes parts.

Fields§

§regular: FilterRegular<'a, 'd, 'tr, T, M, D>

Regular-conversion half.

§injected: FilterInjected<'a, 'd, 'ti, T, M, D>

Injected-conversion half.

§awd: AnalogWatchdog<'a, 'd, T, M>

Analog watchdog.

§extremes: ExtremesDetector<'a, 'd, T, M>

Extremes detector.

Implementations§

Source§

impl<'tr, 'ti, 'a, 'd, T, M, D> Filter<'tr, 'ti, 'a, 'd, T, M, D>

Source

pub fn disable(self) -> FilterDisabled<'a, 'd, T, M>

Disable the filter.

Source

pub fn conversion_timer(&self) -> u32

28-bit conversion-time counter: CNVCNT[27:0] / fDFSDMCLK is the time of the current (or most recent) conversion.

The timer runs on the DFSDM kernel clock (fDFSDMCLK), starts when a conversion starts and stops when it finishes, so it measures the interval between the first and last serial sample of one conversion. The value is proportional to FOSR * IOSR / fCKIN, where fCKIN is the channel input clock (or the parallel input data rate), and it changes with each completed conversion. A bypassed filter (FOSR = 1) yields 0.

Not a reliable liveness signal: it only updates when a conversion completes, so sampling it slower than the conversion rate aliases and looks stuck even while the filter is healthy. Use ClockAbsenceDetector or an overrun/timeout on your reads to detect starvation instead.

Source

pub fn replace_regular_transceiver<'new_reg>( self, transceiver: &'new_reg dyn TransceiverTrait<T, Enabled>, ) -> Filter<'new_reg, 'ti, 'a, 'd, T, M, D>

Replaces the regular transceiver, releasing the old borrow so the previous transceiver can be mutated afterwards. Since this may change the lifetime of the borrows, it consumes and returns a new Filter rather than mutating in place. This is pure borrow-checker bookkeeping, not a hardware requirement - see FilterRegular::assign_transceiver for the in-place alternative when the lifetime doesn’t need to change.

Source

pub fn replace_injected_transceivers<'new_inj, const N: usize>( self, transceivers: [&'new_inj dyn TransceiverTrait<T, Enabled>; N], ) -> Filter<'tr, 'new_inj, 'a, 'd, T, M, D>
where [(); N]: NonEmpty,

Replaces the injected transceivers, releasing the old borrows so the previous transceivers can be mutated afterwards. Since this may change the lifetime of the borrows, it consumes and returns a new Filter rather than mutating in place. This is pure borrow-checker bookkeeping, not a hardware requirement - see FilterInjected::assign_transceivers for the in-place alternative when the lifetime doesn’t need to change.

Trait Implementations§

Source§

impl<'tr, 'ti, 'a, 'd, T, M, D> Drop for Filter<'tr, 'ti, 'a, 'd, T, M, D>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'tr, 'ti, 'a, 'd, T, M, D> !RefUnwindSafe for Filter<'tr, 'ti, 'a, 'd, T, M, D>

§

impl<'tr, 'ti, 'a, 'd, T, M, D> !Send for Filter<'tr, 'ti, 'a, 'd, T, M, D>

§

impl<'tr, 'ti, 'a, 'd, T, M, D> !Sync for Filter<'tr, 'ti, 'a, 'd, T, M, D>

§

impl<'tr, 'ti, 'a, 'd, T, M, D> !UnwindSafe for Filter<'tr, 'ti, 'a, 'd, T, M, D>

§

impl<'tr, 'ti, 'a, 'd, T, M, D> Freeze for Filter<'tr, 'ti, 'a, 'd, T, M, D>
where &'a DfsdmCommon<'d, T, Enabled>: Freeze, FilterRegular<'a, 'd, 'tr, T, M, D>: Freeze, FilterInjected<'a, 'd, 'ti, T, M, D>: Freeze, AnalogWatchdog<'a, 'd, T, M>: Freeze, ExtremesDetector<'a, 'd, T, M>: Freeze,

§

impl<'tr, 'ti, 'a, 'd, T, M, D> Unpin for Filter<'tr, 'ti, 'a, 'd, T, M, D>
where &'a DfsdmCommon<'d, T, Enabled>: Unpin, FilterRegular<'a, 'd, 'tr, T, M, D>: Unpin, FilterInjected<'a, 'd, 'ti, T, M, D>: Unpin, AnalogWatchdog<'a, 'd, T, M>: Unpin, ExtremesDetector<'a, 'd, T, M>: Unpin,

§

impl<'tr, 'ti, 'a, 'd, T, M, D> UnsafeUnpin for Filter<'tr, 'ti, 'a, 'd, T, M, D>
where &'a DfsdmCommon<'d, T, Enabled>: UnsafeUnpin, FilterRegular<'a, 'd, 'tr, T, M, D>: UnsafeUnpin, FilterInjected<'a, 'd, 'ti, T, M, D>: UnsafeUnpin, AnalogWatchdog<'a, 'd, T, M>: UnsafeUnpin, ExtremesDetector<'a, 'd, T, M>: UnsafeUnpin,

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> 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 = !

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.