Struct esp_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(); // successImplementations§
Trait Implementations§
source§impl<T: SpiBus, const SIZE: usize> SpiBus for FlashSafeDma<T, SIZE>
impl<T: SpiBus, const SIZE: usize> SpiBus for FlashSafeDma<T, SIZE>
source§fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
Read
words from the slave. Read moresource§fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
Write
words to the slave, ignoring all the incoming words. Read moresource§fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error>
fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error>
Write and read simultaneously.
write is written to the slave on MOSI and
words received on MISO are stored in read. Read moresource§impl<T: FullDuplex<u8>, const SIZE: usize> FullDuplex<u8> for FlashSafeDma<T, SIZE>
impl<T: FullDuplex<u8>, const SIZE: usize> FullDuplex<u8> for FlashSafeDma<T, SIZE>
Auto Trait Implementations§
impl<T, const SIZE: usize> Freeze for FlashSafeDma<T, SIZE>where
T: Freeze,
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