Struct stm32_hal2::dma::DMAFrame [−][src]
pub struct DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>, { /* fields omitted */ }Data type for holding data frames for the Serial.
Internally used uninitialized storage, making this storage zero cost to create. It can also be
used with, for example, heapless::pool to create a pool of serial frames.
Implementations
impl<N> DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>, [src]
impl<N> DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>, [src]pub fn new() -> Self[src]
Creates a new node for the Serial DMA
pub fn write(&mut self) -> &mut [u8][src]
Gives a &mut [u8] slice to write into with the maximum size, the commit method
must then be used to set the actual number of bytes written.
Note that this function internally first zeros the uninitialized part of the node’s buffer.
pub fn commit(&mut self, shrink_to: usize)[src]
Used to shrink the current size of the frame, used in conjunction with write.
pub fn write_uninit(&mut self) -> &mut [MaybeUninit<u8>][src]
Gives an uninitialized &mut [MaybeUninit<u8>] slice to write into, the set_len method
must then be used to set the actual number of bytes written.
pub unsafe fn set_len(&mut self, len: usize)[src]
Used to set the current size of the frame, used in conjunction with write_uninit to have an
interface for uninitialized memory. Use with care!
Safety
NOTE(unsafe): This must be set so that the final buffer is only referencing initialized memory.
pub fn write_slice(&mut self, buf: &[u8]) -> usize[src]
Used to write data into the node, and returns how many bytes were written from buf.
If the node is already partially filled, this will continue filling the node.
pub fn clear(&mut self)[src]
Clear the node of all data making it empty
pub fn read(&self) -> &[u8][src]
Returns a readable slice which maps to the buffers internal data
pub fn read_mut(&mut self) -> &mut [u8][src]
Returns a readable mutable slice which maps to the buffers internal data
pub fn len(&self) -> usize[src]
Reads how many bytes are available
pub fn free(&self) -> usize[src]
Reads how many bytes are free
pub fn max_len(&self) -> usize[src]
Get the max length of the frame
pub fn is_empty(&self) -> bool[src]
Checks if the frame is empty
Trait Implementations
impl<N> AsSlice for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>, [src]
impl<N> AsSlice for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>, [src]impl<N> Debug for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>, [src]
impl<N> Debug for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>, [src]impl<N> Default for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>, [src]
impl<N> Default for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>, [src]Auto Trait Implementations
impl<N> Unpin for DMAFrame<N> where
<N as ArrayLength<MaybeUninit<u8>>>::ArrayType: Unpin,
impl<N> Unpin for DMAFrame<N> where
<N as ArrayLength<MaybeUninit<u8>>>::ArrayType: Unpin,