Struct esp32c3_hal::FlashSafeDma
source · pub struct FlashSafeDma<T, const SIZE: usize> { /* private fields */ }
Expand description
FlashSafeDma
The embedded-hal traits make no guarantees about where the buffers are placed. The DMA implementation in Espressif chips has a limitation in that it can only access the RAM address space, meaning data to be transmitted from the flash address space must be copied into RAM first.
This wrapper struct should be used when a peripheral using the DMA engine
needs to transmit data from flash (ROM) via the embedded-hal traits. This is
often a const
variable.
Example usage using spi::master::dma::SpiDma
const ARRAY_IN_FLASH = [0xAA; 128]
let spi = SpiDma::new(/* */);
spi.write(&ARRAY_IN_FLASH[..]).unwrap(); // error when transmission starts
let spi = FlashSafeDma::new(spi);
spi.write(&ARRAY_IN_FLASH[..]).unwrap(); // success
Implementations§
Trait Implementations§
source§impl<T, const SIZE: usize> FullDuplex<u8> for FlashSafeDma<T, SIZE>where
T: FullDuplex<u8>,
FlashSafeDma<T, SIZE>: Transfer<u8, Error = <T as FullDuplex<u8>>::Error> + Write<u8, Error = <T as FullDuplex<u8>>::Error>,
impl<T, const SIZE: usize> FullDuplex<u8> for FlashSafeDma<T, SIZE>where T: FullDuplex<u8>, FlashSafeDma<T, SIZE>: Transfer<u8, Error = <T as FullDuplex<u8>>::Error> + Write<u8, Error = <T as FullDuplex<u8>>::Error>,
Auto Trait Implementations§
impl<T, const SIZE: usize> RefUnwindSafe for FlashSafeDma<T, SIZE>where T: RefUnwindSafe,
impl<T, const SIZE: usize> Send for FlashSafeDma<T, SIZE>where T: Send,
impl<T, const SIZE: usize> Sync for FlashSafeDma<T, SIZE>where T: Sync,
impl<T, const SIZE: usize> Unpin for FlashSafeDma<T, SIZE>where T: Unpin,
impl<T, const SIZE: usize> UnwindSafe for FlashSafeDma<T, SIZE>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more