pub trait Stream: StreamISR + Sealed {
const NUMBER: usize;
Show 31 methods
fn set_peripheral_address(&mut self, value: u32);
fn set_memory_address(&mut self, value: u32);
fn get_memory_address(&self) -> u32;
fn set_memory_double_buffer_address(&mut self, value: u32);
fn get_memory_double_buffer_address(&self) -> u32;
fn set_number_of_transfers(&mut self, value: u16);
fn get_number_of_transfers() -> u16;
unsafe fn enable(&mut self);
fn is_enabled() -> bool;
fn disable(&mut self);
fn set_channel<const C: u8>(&mut self)
where
ChannelX<C>: Channel;
fn set_priority(&mut self, priority: Priority);
unsafe fn set_memory_size(&mut self, size: u8);
unsafe fn set_peripheral_size(&mut self, size: u8);
fn set_memory_increment(&mut self, increment: bool);
fn set_peripheral_increment(&mut self, increment: bool);
fn set_direction<D: Direction>(&mut self, direction: D);
fn set_interrupts_enable(
&mut self,
transfer_complete: bool,
half_transfer: bool,
transfer_error: bool,
direct_mode_error: bool
);
fn get_interrupts_enable() -> (bool, bool, bool, bool);
fn set_transfer_complete_interrupt_enable(
&mut self,
transfer_complete_interrupt: bool
);
fn set_half_transfer_interrupt_enable(
&mut self,
half_transfer_interrupt: bool
);
fn set_transfer_error_interrupt_enable(
&mut self,
transfer_error_interrupt: bool
);
fn set_direct_mode_error_interrupt_enable(
&mut self,
direct_mode_error_interrupt: bool
);
fn set_fifo_error_interrupt_enable(&mut self, fifo_error_interrupt: bool);
fn set_double_buffer(&mut self, double_buffer: bool);
fn set_fifo_threshold(&mut self, fifo_threshold: FifoThreshold);
fn set_fifo_enable(&mut self, fifo_enable: bool);
fn set_memory_burst(&mut self, memory_burst: BurstMode);
fn set_peripheral_burst(&mut self, peripheral_burst: BurstMode);
fn fifo_level() -> FifoLevel;
fn current_buffer() -> CurrentBuffer;
}
Expand description
Trait for DMA streams types.
Required Associated Constants
Required Methods
fn set_peripheral_address(&mut self, value: u32)
fn set_peripheral_address(&mut self, value: u32)
Set the peripheral address (par) for the DMA stream.
fn set_memory_address(&mut self, value: u32)
fn set_memory_address(&mut self, value: u32)
Set the memory address (m0ar) for the DMA stream.
fn get_memory_address(&self) -> u32
fn get_memory_address(&self) -> u32
Get the memory address (m0ar) for the DMA stream.
fn set_memory_double_buffer_address(&mut self, value: u32)
fn set_memory_double_buffer_address(&mut self, value: u32)
Set the double buffer address (m1ar) for the DMA stream.
fn get_memory_double_buffer_address(&self) -> u32
fn get_memory_double_buffer_address(&self) -> u32
Get the double buffer address (m1ar) for the DMA stream.
fn set_number_of_transfers(&mut self, value: u16)
fn set_number_of_transfers(&mut self, value: u16)
Set the number of transfers (ndt) for the DMA stream.
fn get_number_of_transfers() -> u16
fn get_number_of_transfers() -> u16
Get the number of transfers (ndt) for the DMA stream.
fn is_enabled() -> bool
fn is_enabled() -> bool
Returns the state of the DMA stream.
Disable the DMA stream.
Disabling the stream during an on-going transfer needs to be performed in a certain way to prevent problems if the stream is to be re-enabled shortly after, because of that, this method will also clear all the stream’s interrupt flags if the stream is active.
fn set_channel<const C: u8>(&mut self) where
ChannelX<C>: Channel,
fn set_channel<const C: u8>(&mut self) where
ChannelX<C>: Channel,
Set the channel for the (chsel) the DMA stream.
fn set_priority(&mut self, priority: Priority)
fn set_priority(&mut self, priority: Priority)
Set the priority (pl) the DMA stream.
unsafe fn set_memory_size(&mut self, size: u8)
unsafe fn set_memory_size(&mut self, size: u8)
Set the memory size (msize) for the DMA stream.
Safety
This must have the same alignment of the buffer used in the transfer. Valid values: * 0 -> byte * 1 -> half word * 2 -> word
unsafe fn set_peripheral_size(&mut self, size: u8)
unsafe fn set_peripheral_size(&mut self, size: u8)
Set the peripheral memory size (psize) for the DMA stream.
Safety
This must have the same alignment of the peripheral data used in the transfer. Valid values: * 0 -> byte * 1 -> half word * 2 -> word
fn set_memory_increment(&mut self, increment: bool)
fn set_memory_increment(&mut self, increment: bool)
Enable/disable memory increment (minc) for the DMA stream.
fn set_peripheral_increment(&mut self, increment: bool)
fn set_peripheral_increment(&mut self, increment: bool)
Enable/disable peripheral increment (pinc) for the DMA stream.
fn set_direction<D: Direction>(&mut self, direction: D)
fn set_direction<D: Direction>(&mut self, direction: D)
Set the direction (dir) of the DMA stream.
Convenience method to configure the 4 common interrupts for the DMA stream.
Convenience method to get the value of the 4 common interrupts for the DMA stream.
The order of the returns are: transfer_complete
, half_transfer
, transfer_error
and
direct_mode_error
.
fn set_transfer_complete_interrupt_enable(
&mut self,
transfer_complete_interrupt: bool
)
fn set_transfer_complete_interrupt_enable(
&mut self,
transfer_complete_interrupt: bool
)
Enable/disable the transfer complete interrupt (tcie) of the DMA stream.
fn set_half_transfer_interrupt_enable(&mut self, half_transfer_interrupt: bool)
fn set_half_transfer_interrupt_enable(&mut self, half_transfer_interrupt: bool)
Enable/disable the half transfer interrupt (htie) of the DMA stream.
fn set_transfer_error_interrupt_enable(
&mut self,
transfer_error_interrupt: bool
)
fn set_transfer_error_interrupt_enable(
&mut self,
transfer_error_interrupt: bool
)
Enable/disable the transfer error interrupt (teie) of the DMA stream.
fn set_direct_mode_error_interrupt_enable(
&mut self,
direct_mode_error_interrupt: bool
)
fn set_direct_mode_error_interrupt_enable(
&mut self,
direct_mode_error_interrupt: bool
)
Enable/disable the direct mode error interrupt (dmeie) of the DMA stream.
fn set_fifo_error_interrupt_enable(&mut self, fifo_error_interrupt: bool)
fn set_fifo_error_interrupt_enable(&mut self, fifo_error_interrupt: bool)
Enable/disable the fifo error interrupt (feie) of the DMA stream.
fn set_double_buffer(&mut self, double_buffer: bool)
fn set_double_buffer(&mut self, double_buffer: bool)
Enable/disable the double buffer (dbm) of the DMA stream.
fn set_fifo_threshold(&mut self, fifo_threshold: FifoThreshold)
fn set_fifo_threshold(&mut self, fifo_threshold: FifoThreshold)
Set the fifo threshold (fcr.fth) of the DMA stream.
fn set_fifo_enable(&mut self, fifo_enable: bool)
fn set_fifo_enable(&mut self, fifo_enable: bool)
Enable/disable the fifo (dmdis) of the DMA stream.
fn set_memory_burst(&mut self, memory_burst: BurstMode)
fn set_memory_burst(&mut self, memory_burst: BurstMode)
Set memory burst mode (mburst) of the DMA stream.
fn set_peripheral_burst(&mut self, peripheral_burst: BurstMode)
fn set_peripheral_burst(&mut self, peripheral_burst: BurstMode)
Set peripheral burst mode (pburst) of the DMA stream.
fn fifo_level() -> FifoLevel
fn fifo_level() -> FifoLevel
Get the current fifo level (fs) of the DMA stream.
fn current_buffer() -> CurrentBuffer
fn current_buffer() -> CurrentBuffer
Get which buffer is currently in use by the DMA.