embassy-stm32

Crates

git

Versions

stm32h747ig-cm7

Flavors

Skip to main content

FilterInjected

Struct FilterInjected 

Source
pub struct FilterInjected<'a, 'd, 't, T, M, D>{ /* private fields */ }
Expand description

Injected-conversion half of a filter.

Implementations§

Source§

impl<'a, 'd, 't, T, M> FilterInjected<'a, 'd, 't, T, M, InjDma>

Source

pub fn ring_buffered<'e, D: Dma<T, M>>( &'e mut self, dma: Peri<'e, D>, irq: impl Binding<D::Interrupt, InterruptHandler<D>> + 'e, dma_buf: &'e mut [u32], ) -> RingBufferedFilter<'e, T, M, InjDma>

Attach a DMA ring buffer to this filter’s injected-conversion data register.

Source§

impl<'a, 'd, 't, T, M, D> FilterInjected<'a, 'd, 't, T, M, D>

Source

pub fn assign_transceivers<const N: usize>( &mut self, transceivers: [&'t dyn TransceiverTrait<T, Enabled>; N], )
where [(); N]: NonEmpty,

Reassigns the transceivers for injected conversions in-place.

The new transceiver must live at least as long as the previous one ('t), since this does not change the FilterInjected’s lifetime parameter. Use Filter::replace_injected_transceivers if you need to assign a transceiver with a shorter/different lifetime and get the old one back for further mutation.

§Note

Unlike the regular channel select, the injected select (JCHGR) takes effect immediately and resets any injected scan in progress.

Source

pub fn start_conversion(&mut self)

Start an injected conversion.

§Note

The request is ignored while an injected conversion is in progress (JCIP). An injected conversion preempts a running regular conversion (flagged via ResultRegular::pending).

Source

pub async fn read(&mut self) -> Result<ResultInjected, Error>

Await the next injected conversion result.

Does not start a conversion: the conversion must already be running, started by an external trigger, or started via start_and_read. Resolves with the next ResultInjected once a conversion completes.

§Note

Like FilterRegular::read, this hangs forever if the filter is starved (no data produced, or no trigger); see that method for the layered starvation detection.

Source

pub async fn start_and_read(&mut self) -> Result<ResultInjected, Error>

Start an injected conversion and await its result.

Equivalent to start_conversion followed by read: the read future waits for the conversion it just launched.

Source

pub fn try_get_result(&mut self) -> Result<ResultInjected, Error>

Attempts to read the current injected conversion result.

Returns ResultInjected if JEOCF is set, Error::Overrun if an overrun occurred, or Error::NotReady if no conversion result is available.

The conversion result is sign-extended from 24 to 32 bits and is not scaled.

Reading the result clears the corresponding data register.

Source

pub fn get_result_unchecked(&mut self) -> ResultInjected

Reads and clears the current injected conversion result without checking JEOCF.

The conversion result is sign-extended from 24 to 32 bits and is not scaled.

The returned data is only valid if JEOCF was set before reading.

§Note

This path does not check or clear the overrun flag; use try_get_result to propagate overruns.

Source

pub fn end_of_conversion(&self) -> bool

Returns whether an injected conversion result is available.

Source

pub fn overrun(&self) -> bool

Whether the injected overrun flag is set.

Source

pub fn clear_overrun(&self)

Clear the injected overrun flag.

Source

pub fn conversion_in_progress(&self) -> bool

Returns whether an injected conversion is currently in progress or pending.

Source§

impl<'a, 'd, 't, T, M> FilterInjected<'a, 'd, 't, T, M, InjDma>

Source

pub fn data_register(&mut self) -> *mut u32

Pointer to JDATAR, for custom DMA setups instead of ring_buffered.

Reading clears the register, hence &mut self. Valid as long as the underlying DfsdmCommon stays enabled; no Rust lifetime ties to it.

Trait Implementations§

Source§

impl<'a, 'd, 't, T, M> FilterDma<T, M> for FilterInjected<'a, 'd, 't, T, M, InjDma>

Source§

fn data_register(&mut self) -> *mut u32

Pointer to the filter’s data register (RDATAR for the regular half, JDATAR for injected), for custom DMA.
Source§

fn start_conversion(&mut self)

Starts a conversion (regular or injected, depending on the half).
Source§

fn get_and_clear_overrun(&mut self) -> bool

Checks and clears the overrun flag; returns whether it was set.

Auto Trait Implementations§

§

impl<'a, 'd, 't, T, M, D> !RefUnwindSafe for FilterInjected<'a, 'd, 't, T, M, D>

§

impl<'a, 'd, 't, T, M, D> !Send for FilterInjected<'a, 'd, 't, T, M, D>

§

impl<'a, 'd, 't, T, M, D> !Sync for FilterInjected<'a, 'd, 't, T, M, D>

§

impl<'a, 'd, 't, T, M, D> !UnwindSafe for FilterInjected<'a, 'd, 't, T, M, D>

§

impl<'a, 'd, 't, T, M, D> Freeze for FilterInjected<'a, 'd, 't, T, M, D>
where PhantomData<(&'a DfsdmCommon<'d, T, Enabled>, M, D)>: Freeze, [Option<&'t dyn TransceiverTrait<T, Enabled>>; 8]: Freeze,

§

impl<'a, 'd, 't, T, M, D> Unpin for FilterInjected<'a, 'd, 't, T, M, D>
where PhantomData<(&'a DfsdmCommon<'d, T, Enabled>, M, D)>: Unpin, [Option<&'t dyn TransceiverTrait<T, Enabled>>; 8]: Unpin,

§

impl<'a, 'd, 't, T, M, D> UnsafeUnpin for FilterInjected<'a, 'd, 't, T, M, D>
where PhantomData<(&'a DfsdmCommon<'d, T, Enabled>, M, D)>: UnsafeUnpin, [Option<&'t dyn TransceiverTrait<T, Enabled>>; 8]: 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.