Align examples

This commit is contained in:
Rasmus Melchior Jacobsen
2023-05-24 17:31:35 +02:00
parent 44b6494ab7
commit 525e065474
6 changed files with 36 additions and 36 deletions

View File

@ -18,23 +18,23 @@ async fn main(_spawner: Spawner) {
// wait a bit before accessing the flash
Timer::after(Duration::from_millis(300)).await;
let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank2_region.into_blocking() };
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank2_region;
info!("Reading...");
let mut buf = [0u8; 32];
unwrap!(f.read(ADDR, &mut buf));
unwrap!(f.read_blocking(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf);
info!("Erasing...");
unwrap!(f.erase(ADDR, ADDR + 128 * 1024));
unwrap!(f.erase_blocking(ADDR, ADDR + 128 * 1024));
info!("Reading...");
let mut buf = [0u8; 32];
unwrap!(f.read(ADDR, &mut buf));
unwrap!(f.read_blocking(ADDR, &mut buf));
info!("Read after erase: {=[u8]:x}", buf);
info!("Writing...");
unwrap!(f.write(
unwrap!(f.write_blocking(
ADDR,
&[
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
@ -44,7 +44,7 @@ async fn main(_spawner: Spawner) {
info!("Reading...");
let mut buf = [0u8; 32];
unwrap!(f.read(ADDR, &mut buf));
unwrap!(f.read_blocking(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf);
assert_eq!(
&buf[..],