embassy-stm32

Crates

git

Versions

stm32u5a5qj

Flavors

Skip to main content

TriggeredFrames

Struct TriggeredFrames 

Source
pub struct TriggeredFrames<'a, W: Word, const N: usize> { /* private fields */ }
Expand description

A stream of triggered frames. Dropping it stops the stream and restores the Spi.

Implementations§

Source§

impl<'a, W: Word, const N: usize> TriggeredFrames<'a, W, N>

Source

pub fn new<T: InterruptInstance>( spi: &'a mut Spi<'_, Async, Master>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'a, rearm: &'a mut Channel<'_>, config: Config, descriptors: &'a mut Descriptors<N>, ring: &'a mut [W], tx_frame: &'a [W], ) -> Self

Start streaming: every edge of config.trigger runs one frame.

  • spi: instance T, with both DMA channels; its mode and frequency apply to the frames.
  • rearm: a third channel of the same DMA controller.
  • tx_frame: sent each frame; its length is the frame length, at most 65535 words.
  • ring: N blocks of whole frames, at most MAX_FRAMES_PER_BLOCK frames and 65535 bytes per block.

The trigger source is set up separately (e.g. ExtiInput::enable_event). The first block may hold frames from before the call.

Source

pub async fn next_block(&mut self) -> Result<Block<'_, W>, Error>

The next block, read in place. Error::Overrun if the consumer fell a ring behind, also while it held the previous block.

Source

pub fn take_missed_trigger(&mut self) -> bool

Whether a trigger was lost because the previous one was still being served. Clears it.

Source

pub fn crc_errors(&self) -> u32

Frames that failed their CRC since the stream started.

Source

pub fn overruns(&self) -> u32

SPI receive overruns since the stream started.

Source

pub fn frames_per_block(&self) -> usize

Frames per block.

Trait Implementations§

Source§

impl<W: Word, const N: usize> Drop for TriggeredFrames<'_, W, N>

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<'a, W, const N: usize> !RefUnwindSafe for TriggeredFrames<'a, W, N>

§

impl<'a, W, const N: usize> !Send for TriggeredFrames<'a, W, N>

§

impl<'a, W, const N: usize> !Sync for TriggeredFrames<'a, W, N>

§

impl<'a, W, const N: usize> !UnwindSafe for TriggeredFrames<'a, W, N>

§

impl<'a, W, const N: usize> Freeze for TriggeredFrames<'a, W, N>
where *const W: Freeze, &'a [[Atomic<u32>; 2]; N]: Freeze, PhantomData<&'a mut [W]>: Freeze,

§

impl<'a, W, const N: usize> Unpin for TriggeredFrames<'a, W, N>
where *const W: Unpin, &'a [[Atomic<u32>; 2]; N]: Unpin, PhantomData<&'a mut [W]>: Unpin,

§

impl<'a, W, const N: usize> UnsafeUnpin for TriggeredFrames<'a, W, N>

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.