Merge pull request #3154 from Dicklessgreat/main
Fix BDMA example for soundness
This commit is contained in:
@ -10,18 +10,24 @@ use embassy_executor::Executor;
|
|||||||
use embassy_stm32::mode::Async;
|
use embassy_stm32::mode::Async;
|
||||||
use embassy_stm32::time::mhz;
|
use embassy_stm32::time::mhz;
|
||||||
use embassy_stm32::{spi, Config};
|
use embassy_stm32::{spi, Config};
|
||||||
|
use grounded::uninit::GroundedArrayCell;
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
// Defined in memory.x
|
// Defined in memory.x
|
||||||
#[link_section = ".ram_d3"]
|
#[link_section = ".ram_d3"]
|
||||||
static mut RAM_D3: [u8; 64 * 1024] = [0u8; 64 * 1024];
|
static mut RAM_D3: GroundedArrayCell<u8, 256> = GroundedArrayCell::uninit();
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn main_task(mut spi: spi::Spi<'static, Async>) {
|
async fn main_task(mut spi: spi::Spi<'static, Async>) {
|
||||||
let read_buffer = unsafe { &mut RAM_D3[0..128] };
|
let (read_buffer, write_buffer) = unsafe {
|
||||||
let write_buffer = unsafe { &mut RAM_D3[128..256] };
|
RAM_D3.initialize_all_copied(0);
|
||||||
|
(
|
||||||
|
RAM_D3.get_subslice_mut_unchecked(0, 128),
|
||||||
|
RAM_D3.get_subslice_mut_unchecked(128, 128),
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
for n in 0u32.. {
|
for n in 0u32.. {
|
||||||
let mut write: String<128> = String::new();
|
let mut write: String<128> = String::new();
|
||||||
|
Reference in New Issue
Block a user