From 525e06547483de4d431bda2991555a97a0197346 Mon Sep 17 00:00:00 2001
From: Rasmus Melchior Jacobsen <rmja@laesoe.org>
Date: Wed, 24 May 2023 17:31:35 +0200
Subject: [PATCH] Align examples

---
 examples/stm32f3/src/bin/flash.rs | 12 ++++++------
 examples/stm32f7/src/bin/flash.rs | 12 ++++++------
 examples/stm32h7/src/bin/flash.rs | 12 ++++++------
 examples/stm32l0/src/bin/flash.rs | 12 ++++++------
 examples/stm32l1/src/bin/flash.rs | 12 ++++++------
 examples/stm32wl/src/bin/flash.rs | 12 ++++++------
 6 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/examples/stm32f3/src/bin/flash.rs b/examples/stm32f3/src/bin/flash.rs
index 0e5fb0658..befae0a16 100644
--- a/examples/stm32f3/src/bin/flash.rs
+++ b/examples/stm32f3/src/bin/flash.rs
@@ -14,27 +14,27 @@ async fn main(_spawner: Spawner) {
 
     const ADDR: u32 = 0x26000;
 
-    let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() };
+    let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    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 + 2048));
+    unwrap!(f.erase_blocking(ADDR, ADDR + 2048));
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    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(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
+    unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    unwrap!(f.read(ADDR, &mut buf));
+    unwrap!(f.read_blocking(ADDR, &mut buf));
     info!("Read: {=[u8]:x}", buf);
     assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
 }
diff --git a/examples/stm32f7/src/bin/flash.rs b/examples/stm32f7/src/bin/flash.rs
index 717c82e86..5507e7310 100644
--- a/examples/stm32f7/src/bin/flash.rs
+++ b/examples/stm32f7/src/bin/flash.rs
@@ -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().bank1_region3.into_blocking() };
+    let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region3;
 
     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 + 256 * 1024));
+    unwrap!(f.erase_blocking(ADDR, ADDR + 256 * 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[..],
diff --git a/examples/stm32h7/src/bin/flash.rs b/examples/stm32h7/src/bin/flash.rs
index aab72cae8..fe6dad249 100644
--- a/examples/stm32h7/src/bin/flash.rs
+++ b/examples/stm32h7/src/bin/flash.rs
@@ -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[..],
diff --git a/examples/stm32l0/src/bin/flash.rs b/examples/stm32l0/src/bin/flash.rs
index 0ed0d05fc..4182c87b1 100644
--- a/examples/stm32l0/src/bin/flash.rs
+++ b/examples/stm32l0/src/bin/flash.rs
@@ -14,27 +14,27 @@ async fn main(_spawner: Spawner) {
 
     const ADDR: u32 = 0x26000;
 
-    let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() };
+    let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    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));
+    unwrap!(f.erase_blocking(ADDR, ADDR + 128));
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    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(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
+    unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    unwrap!(f.read(ADDR, &mut buf));
+    unwrap!(f.read_blocking(ADDR, &mut buf));
     info!("Read: {=[u8]:x}", buf);
     assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
 }
diff --git a/examples/stm32l1/src/bin/flash.rs b/examples/stm32l1/src/bin/flash.rs
index c4d7d029c..53052e7c5 100644
--- a/examples/stm32l1/src/bin/flash.rs
+++ b/examples/stm32l1/src/bin/flash.rs
@@ -14,27 +14,27 @@ async fn main(_spawner: Spawner) {
 
     const ADDR: u32 = 0x26000;
 
-    let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() };
+    let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    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 + 256));
+    unwrap!(f.erase_blocking(ADDR, ADDR + 256));
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    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(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
+    unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    unwrap!(f.read(ADDR, &mut buf));
+    unwrap!(f.read_blocking(ADDR, &mut buf));
     info!("Read: {=[u8]:x}", buf);
     assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
 }
diff --git a/examples/stm32wl/src/bin/flash.rs b/examples/stm32wl/src/bin/flash.rs
index df51ceb68..e03b69b82 100644
--- a/examples/stm32wl/src/bin/flash.rs
+++ b/examples/stm32wl/src/bin/flash.rs
@@ -14,27 +14,27 @@ async fn main(_spawner: Spawner) {
 
     const ADDR: u32 = 0x36000;
 
-    let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() };
+    let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    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 + 2048));
+    unwrap!(f.erase_blocking(ADDR, ADDR + 2048));
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    unwrap!(f.read(ADDR, &mut buf));
+    unwrap!(f.read_blocking(ADDR, &mut buf));
     info!("Read: {=[u8]:x}", buf);
 
     info!("Writing...");
-    unwrap!(f.write(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
+    unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
 
     info!("Reading...");
     let mut buf = [0u8; 8];
-    unwrap!(f.read(ADDR, &mut buf));
+    unwrap!(f.read_blocking(ADDR, &mut buf));
     info!("Read: {=[u8]:x}", buf);
     assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
 }