Dma

Struct Dma 

Source
pub struct Dma<D> {
    pub regs: D,
}
Expand description

Represents a Direct Memory Access (DMA) peripheral.

Fields§

§regs: D

Implementations§

Source§

impl<D> Dma<D>
where D: Deref<Target = RegisterBlock>,

Source

pub fn new(regs: D) -> Self

Initialize a DMA peripheral, including enabling and resetting its RCC peripheral clock.

Source

pub fn cfg_channel( &mut self, channel: DmaChannel, periph_addr: u32, mem_addr: u32, num_data: u32, direction: Direction, periph_size: DataSize, mem_size: DataSize, cfg: ChannelCfg, ) -> Result<()>

Configure a DMA channel. See L4 RM 0394, section 11.4.4. Sets the Transfer Complete interrupt. Note that this fn has been (perhaps) depreciated by the standalone fn.

Source

pub fn stop(&mut self, channel: DmaChannel) -> Result<()>

Stop a DMA transfer, if in progress.

Source

pub fn clear_interrupt( &mut self, channel: DmaChannel, interrupt: DmaInterrupt, ) -> Result<()>

Clear an interrupt flag.

Source

pub fn transfer_is_complete(&mut self, channel: DmaChannel) -> bool

Source

pub fn enable_interrupt( &mut self, channel: DmaChannel, interrupt: DmaInterrupt, ) -> Result<()>

Enable a specific type of interrupt.

Source

pub fn disable_interrupt( &mut self, channel: DmaChannel, interrupt: DmaInterrupt, ) -> Result<()>

Disable a specific type of interrupt. todo: Non-H7 version too!

Methods from Deref<Target = RegisterBlock>§

Source

pub fn isr(&self) -> &Reg<ISRrs>

0x00 - interrupt status register

Source

pub fn ifcr(&self) -> &Reg<IFCRrs>

0x04 - DMA interrupt flag clear register

Source

pub fn ch(&self, n: usize) -> &CH

0x08..0xa8 - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

`n` is the index of cluster in the array. `n == 0` corresponds to `CH1` cluster.
Source

pub fn ch_iter(&self) -> impl Iterator<Item = &CH>

Iterator for array of: 0x08..0xa8 - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

Source

pub fn ch1(&self) -> &CH

0x08..0x1c - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

Source

pub fn ch2(&self) -> &CH

0x1c..0x30 - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

Source

pub fn ch3(&self) -> &CH

0x30..0x44 - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

Source

pub fn ch4(&self) -> &CH

0x44..0x58 - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

Source

pub fn ch5(&self) -> &CH

0x58..0x6c - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

Source

pub fn ch6(&self) -> &CH

0x6c..0x80 - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

Source

pub fn ch7(&self) -> &CH

0x80..0x94 - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

Source

pub fn ch8(&self) -> &CH

0x94..0xa8 - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers

Trait Implementations§

Source§

impl<D> Deref for Dma<D>
where D: Deref<Target = RegisterBlock>,

Source§

type Target = RegisterBlock

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<D> Freeze for Dma<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for Dma<D>
where D: RefUnwindSafe,

§

impl<D> Send for Dma<D>
where D: Send,

§

impl<D> Sync for Dma<D>
where D: Sync,

§

impl<D> Unpin for Dma<D>
where D: Unpin,

§

impl<D> UnwindSafe for Dma<D>
where D: UnwindSafe,

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.