pub trait Stream:
StreamISR
+ Listen<Event = DmaEvent>
+ Sealed {
const NUMBER: usize;
Show 38 methods
// Required methods
fn set_peripheral_address(&mut self, value: u32);
fn set_memory_address(&mut self, value: u32);
fn memory_address(&self) -> u32;
fn set_alternate_memory_address(&mut self, value: u32);
fn alternate_memory_address(&self) -> u32;
fn set_number_of_transfers(&mut self, value: u16);
fn number_of_transfers(&self) -> u16;
unsafe fn enable(&mut self);
fn is_enabled(&self) -> bool;
unsafe fn disable(&mut self);
fn set_channel(&mut self, channel: DmaChannel);
fn set_priority(&mut self, priority: Priority);
fn set_peripheral_increment_offset(
&mut self,
value: PeripheralIncrementOffset,
);
unsafe fn set_memory_size(&mut self, size: DmaDataSize);
unsafe fn set_peripheral_size(&mut self, size: DmaDataSize);
fn set_memory_increment(&mut self, increment: bool);
fn set_peripheral_increment(&mut self, increment: bool);
fn set_circular_mode(&mut self, value: bool);
fn set_direction(&mut self, direction: DmaDirection);
fn set_flow_controller(&mut self, value: DmaFlowController);
fn events(&self) -> BitFlags<DmaEvent>;
fn listen_fifo_error(&mut self);
fn unlisten_fifo_error(&mut self);
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(&self) -> FifoLevel;
fn current_buffer(&self) -> CurrentBuffer;
// Provided methods
fn listen_transfer_complete(&mut self) { ... }
fn unlisten_transfer_complete(&mut self) { ... }
fn listen_half_transfer(&mut self) { ... }
fn unlisten_half_transfer(&mut self) { ... }
fn listen_transfer_error(&mut self) { ... }
fn unlisten_transfer_error(&mut self) { ... }
fn listen_direct_mode_error(&mut self) { ... }
fn unlisten_direct_mode_error(&mut self) { ... }
}
Expand description
Trait for DMA streams types.
Required Associated Constants§
Required Methods§
Sourcefn set_peripheral_address(&mut self, value: u32)
fn set_peripheral_address(&mut self, value: u32)
Set the peripheral address (par) of the DMA stream.
Sourcefn set_memory_address(&mut self, value: u32)
fn set_memory_address(&mut self, value: u32)
Set the memory address (m0ar) of the DMA stream.
Sourcefn memory_address(&self) -> u32
fn memory_address(&self) -> u32
Get the memory address (m0ar) of the DMA stream.
Sourcefn set_alternate_memory_address(&mut self, value: u32)
fn set_alternate_memory_address(&mut self, value: u32)
Set the second memory address (m1ar) of the DMA stream. Only relevant with double buffer mode.
Sourcefn alternate_memory_address(&self) -> u32
fn alternate_memory_address(&self) -> u32
Get the second memory address (m1ar) of the DMA stream. Only relevant with double buffer mode.
Sourcefn 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.
Sourcefn number_of_transfers(&self) -> u16
fn number_of_transfers(&self) -> u16
Get the number of transfers (ndt) for the DMA stream.
Sourcefn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Returns the state of the DMA stream.
Sourceunsafe fn disable(&mut self)
unsafe fn disable(&mut self)
Disable the DMA stream.
Disabling may not immediate, you must check with is_enabled()
to
ensure the stream is correctly disabled. Note that the transfer complete interrupt flag is
set when the stream is disabled. You need to delete transfer complete interrupt flag before
re-enabling the stream. It’s also advisable to clear all interrupt flag before re-enabling
the stream.
§Safety
Disabling the stream before end of transfers may produce invalid data.
Sourcefn set_channel(&mut self, channel: DmaChannel)
fn set_channel(&mut self, channel: DmaChannel)
Set the channel for the (chsel) the DMA stream.
Sourcefn set_priority(&mut self, priority: Priority)
fn set_priority(&mut self, priority: Priority)
Set the priority (pl) the DMA stream.
Sourcefn set_peripheral_increment_offset(&mut self, value: PeripheralIncrementOffset)
fn set_peripheral_increment_offset(&mut self, value: PeripheralIncrementOffset)
Set the peripheral increment offset (pincos)
Sourceunsafe fn set_memory_size(&mut self, size: DmaDataSize)
unsafe fn set_memory_size(&mut self, size: DmaDataSize)
Set the memory size (msize) for the DMA stream.
§Safety
This must have the same alignment of the buffer used in the transfer.
Sourceunsafe fn set_peripheral_size(&mut self, size: DmaDataSize)
unsafe fn set_peripheral_size(&mut self, size: DmaDataSize)
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.
Sourcefn set_memory_increment(&mut self, increment: bool)
fn set_memory_increment(&mut self, increment: bool)
Enable/disable memory increment (minc) for the DMA stream.
Sourcefn set_peripheral_increment(&mut self, increment: bool)
fn set_peripheral_increment(&mut self, increment: bool)
Enable/disable peripheral increment (pinc) for the DMA stream.
Sourcefn set_circular_mode(&mut self, value: bool)
fn set_circular_mode(&mut self, value: bool)
Enable/disable circular mode (circ) for the DMA stream.
Sourcefn set_direction(&mut self, direction: DmaDirection)
fn set_direction(&mut self, direction: DmaDirection)
Set the direction (dir) of the DMA stream.
Sourcefn set_flow_controller(&mut self, value: DmaFlowController)
fn set_flow_controller(&mut self, value: DmaFlowController)
Set the flow controller (pfctrl).
Sourcefn events(&self) -> BitFlags<DmaEvent>
fn events(&self) -> BitFlags<DmaEvent>
Convenience method to get the value of several interrupts of the DMA stream. The order of the
returns are: transfer_complete
, half_transfer
, transfer_error
and direct_mode_error
Note: fifo_error interrupt is not returned because it’s in a different register
Sourcefn listen_fifo_error(&mut self)
fn listen_fifo_error(&mut self)
Enable the fifo error interrupt (feie) of the DMA stream.
Sourcefn unlisten_fifo_error(&mut self)
fn unlisten_fifo_error(&mut self)
Disable the fifo error interrupt (feie) of the DMA stream.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn fifo_level(&self) -> FifoLevel
fn fifo_level(&self) -> FifoLevel
Get the current fifo level (fs) of the DMA stream.
Sourcefn current_buffer(&self) -> CurrentBuffer
fn current_buffer(&self) -> CurrentBuffer
Get which buffer is currently in use by the DMA.
Provided Methods§
Sourcefn listen_transfer_complete(&mut self)
fn listen_transfer_complete(&mut self)
Enable the transfer complete interrupt (tcie) of the DMA stream.
Sourcefn unlisten_transfer_complete(&mut self)
fn unlisten_transfer_complete(&mut self)
Disable the transfer complete interrupt (tcie) of the DMA stream.
Sourcefn listen_half_transfer(&mut self)
fn listen_half_transfer(&mut self)
Enable the half transfer interrupt (htie) of the DMA stream.
Sourcefn unlisten_half_transfer(&mut self)
fn unlisten_half_transfer(&mut self)
Disable the half transfer interrupt (htie) of the DMA stream.
Sourcefn listen_transfer_error(&mut self)
fn listen_transfer_error(&mut self)
Enable the transfer error interrupt (teie) of the DMA stream.
Sourcefn unlisten_transfer_error(&mut self)
fn unlisten_transfer_error(&mut self)
Disable the transfer error interrupt (teie) of the DMA stream.
Sourcefn listen_direct_mode_error(&mut self)
fn listen_direct_mode_error(&mut self)
Enable the direct mode error interrupt (dmeie) of the DMA stream.
Sourcefn unlisten_direct_mode_error(&mut self)
fn unlisten_direct_mode_error(&mut self)
Disable the direct mode error interrupt (dmeie) of the DMA stream.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.