pub struct Transfer<STREAM, const CHANNEL: u8, PERIPHERAL, DIRECTION, BUF> where
    STREAM: Stream,
    PERIPHERAL: PeriAddress
{ /* private fields */ }
Expand description

DMA Transfer.

Implementations

Configures the DMA stream to the correct channel for the peripheral, configures source and destination and applies supplied configuration. If double buffering is enabled, the number of transfers will be the minimum length of memory and double_buf.

Panics
  • When double buffering is enabled but the double_buf argument is None.

Changes the buffer and restarts or continues a double buffer transfer. This must be called immediately after a transfer complete event if using double buffering, otherwise you might lose data. Returns the old buffer together with its CurrentBuffer. If an error occurs, this method will return the new buffer with the error.

This method will clear the transfer complete flag on entry, it will also clear it again if an overrun occurs during its execution. Moreover, if an overrun occurs, the stream will be disabled and the transfer error flag will be set. This method can be called before the end of an ongoing transfer only if not using double buffering, in that case, the current transfer will be canceled and a new one will be started. A NotReady error will be returned if this method is called before the end of a transfer while double buffering.

Changes the buffer and restarts or continues a double buffer transfer. This must be called immediately after a transfer complete event if using double buffering, otherwise you might lose data. The closure must return (BUF, T) where BUF is the new buffer to be used. This method can be called before the end of an ongoing transfer only if not using double buffering, in that case, the current transfer will be canceled and a new one will be started. A NotReady error will be returned if this method is called before the end of a transfer while double buffering and the closure won’t be executed.

Panics

This method will panic when double buffering if one or both of the following conditions happen:

  • The new buffer’s length is smaller than the one used in the init method.
  • The closure f takes too long to return and a buffer overrun occurs.
Safety

Memory corruption might occur in the previous buffer, the one passed to the closure, if an overrun occurs in double buffering mode.

Access the owned peripheral for reading

Configures the DMA stream to the correct channel for the peripheral, configures source and destination and applies supplied configuration. If double buffering is enabled, the number of transfers will be the minimum length of memory and double_buf.

Panics
  • When double buffering is enabled but the double_buf argument is None.

Changes the buffer and restarts or continues a double buffer transfer. This must be called immediately after a transfer complete event if using double buffering, otherwise you might lose data. Returns the old buffer together with its CurrentBuffer. If an error occurs, this method will return the new buffer with the error.

This method will clear the transfer complete flag on entry, it will also clear it again if an overrun occurs during its execution. Moreover, if an overrun occurs, the stream will be disabled and the transfer error flag will be set. This method can be called before the end of an ongoing transfer only if not using double buffering, in that case, the current transfer will be canceled and a new one will be started. A NotReady error will be returned if this method is called before the end of a transfer while double buffering.

Changes the buffer and restarts or continues a double buffer transfer. This must be called immediately after a transfer complete event if using double buffering, otherwise you might lose data. The closure must return (BUF, T) where BUF is the new buffer to be used. This method can be called before the end of an ongoing transfer only if not using double buffering, in that case, the current transfer will be canceled and a new one will be started. A NotReady error will be returned if this method is called before the end of a transfer while double buffering and the closure won’t be executed.

Panics

This method will panic when double buffering if one or both of the following conditions happen:

  • The new buffer’s length is smaller than the one used in the init method.
  • The closure f takes too long to return and a buffer overrun occurs.
Safety

Memory corruption might occur in the previous buffer, the one passed to the closure, if an overrun occurs in double buffering mode.

Configures the DMA stream to the correct channel for the peripheral, configures source and destination and applies supplied configuration. In a memory to memory transfer, the double_buf argument is the source of the data. If double buffering is enabled, the number of transfers will be the minimum length of memory and double_buf.

Panics
  • When the FIFO is disabled or double buffering is enabled in DmaConfig while initializing a memory to memory transfer.

Changes the buffer and restarts.Returns the old buffer together with its CurrentBuffer. If an error occurs, this method will return the new buffer with the error.

This method will clear the transfer complete flag on entry. This method can be called before the end of an ongoing transfer, in that case, the current transfer will be canceled and a new one will be started.

Changes the buffer and restarts a transfer. This must be called The closure must return (BUF, T) where BUF is the new buffer to be used. This method can be called before the end of an ongoing transfer, in that case, the current transfer will be canceled and a new one will be started.

Starts the transfer, the closure will be executed right after enabling the stream.

Pauses the dma stream, the closure will be executed right before disabling the stream.

Stops the stream and returns the underlying resources.

Clear all interrupts for the DMA stream.

Clear transfer complete interrupt (tcif) for the DMA stream.

Clear half transfer interrupt (htif) for the DMA stream.

Clear transfer error interrupt (teif) for the DMA stream.

Clear direct mode error interrupt (dmeif) for the DMA stream.

Clear fifo error interrupt (feif) for the DMA stream.

Get the underlying stream of the transfer.

Safety

This implementation relies on several configurations points in order to be sound, this method can void that. The use of this method is completely discouraged, only use it if you know the internals of this API in its entirety.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.