aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRasmus Melchior Jacobsen <[email protected]>2023-05-24 17:31:35 +0200
committerRasmus Melchior Jacobsen <[email protected]>2023-05-25 20:07:42 +0200
commit525e06547483de4d431bda2991555a97a0197346 (patch)
tree20be98c99dca9421e673c1e930de7efec2aba650 /examples
parent44b6494ab7ec3e742aa9f82a8ca9ebdfc23ebbba (diff)
Align examples
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32f3/src/bin/flash.rs12
-rw-r--r--examples/stm32f7/src/bin/flash.rs12
-rw-r--r--examples/stm32h7/src/bin/flash.rs12
-rw-r--r--examples/stm32l0/src/bin/flash.rs12
-rw-r--r--examples/stm32l1/src/bin/flash.rs12
-rw-r--r--examples/stm32wl/src/bin/flash.rs12
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) {
14 14
15 const ADDR: u32 = 0x26000; 15 const ADDR: u32 = 0x26000;
16 16
17 let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() }; 17 let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
18 18
19 info!("Reading..."); 19 info!("Reading...");
20 let mut buf = [0u8; 8]; 20 let mut buf = [0u8; 8];
21 unwrap!(f.read(ADDR, &mut buf)); 21 unwrap!(f.read_blocking(ADDR, &mut buf));
22 info!("Read: {=[u8]:x}", buf); 22 info!("Read: {=[u8]:x}", buf);
23 23
24 info!("Erasing..."); 24 info!("Erasing...");
25 unwrap!(f.erase(ADDR, ADDR + 2048)); 25 unwrap!(f.erase_blocking(ADDR, ADDR + 2048));
26 26
27 info!("Reading..."); 27 info!("Reading...");
28 let mut buf = [0u8; 8]; 28 let mut buf = [0u8; 8];
29 unwrap!(f.read(ADDR, &mut buf)); 29 unwrap!(f.read_blocking(ADDR, &mut buf));
30 info!("Read after erase: {=[u8]:x}", buf); 30 info!("Read after erase: {=[u8]:x}", buf);
31 31
32 info!("Writing..."); 32 info!("Writing...");
33 unwrap!(f.write(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8])); 33 unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
34 34
35 info!("Reading..."); 35 info!("Reading...");
36 let mut buf = [0u8; 8]; 36 let mut buf = [0u8; 8];
37 unwrap!(f.read(ADDR, &mut buf)); 37 unwrap!(f.read_blocking(ADDR, &mut buf));
38 info!("Read: {=[u8]:x}", buf); 38 info!("Read: {=[u8]:x}", buf);
39 assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]); 39 assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
40} 40}
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) {
18 // wait a bit before accessing the flash 18 // wait a bit before accessing the flash
19 Timer::after(Duration::from_millis(300)).await; 19 Timer::after(Duration::from_millis(300)).await;
20 20
21 let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region3.into_blocking() }; 21 let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region3;
22 22
23 info!("Reading..."); 23 info!("Reading...");
24 let mut buf = [0u8; 32]; 24 let mut buf = [0u8; 32];
25 unwrap!(f.read(ADDR, &mut buf)); 25 unwrap!(f.read_blocking(ADDR, &mut buf));
26 info!("Read: {=[u8]:x}", buf); 26 info!("Read: {=[u8]:x}", buf);
27 27
28 info!("Erasing..."); 28 info!("Erasing...");
29 unwrap!(f.erase(ADDR, ADDR + 256 * 1024)); 29 unwrap!(f.erase_blocking(ADDR, ADDR + 256 * 1024));
30 30
31 info!("Reading..."); 31 info!("Reading...");
32 let mut buf = [0u8; 32]; 32 let mut buf = [0u8; 32];
33 unwrap!(f.read(ADDR, &mut buf)); 33 unwrap!(f.read_blocking(ADDR, &mut buf));
34 info!("Read after erase: {=[u8]:x}", buf); 34 info!("Read after erase: {=[u8]:x}", buf);
35 35
36 info!("Writing..."); 36 info!("Writing...");
37 unwrap!(f.write( 37 unwrap!(f.write_blocking(
38 ADDR, 38 ADDR,
39 &[ 39 &[
40 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, 40 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) {
44 44
45 info!("Reading..."); 45 info!("Reading...");
46 let mut buf = [0u8; 32]; 46 let mut buf = [0u8; 32];
47 unwrap!(f.read(ADDR, &mut buf)); 47 unwrap!(f.read_blocking(ADDR, &mut buf));
48 info!("Read: {=[u8]:x}", buf); 48 info!("Read: {=[u8]:x}", buf);
49 assert_eq!( 49 assert_eq!(
50 &buf[..], 50 &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) {
18 // wait a bit before accessing the flash 18 // wait a bit before accessing the flash
19 Timer::after(Duration::from_millis(300)).await; 19 Timer::after(Duration::from_millis(300)).await;
20 20
21 let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank2_region.into_blocking() }; 21 let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank2_region;
22 22
23 info!("Reading..."); 23 info!("Reading...");
24 let mut buf = [0u8; 32]; 24 let mut buf = [0u8; 32];
25 unwrap!(f.read(ADDR, &mut buf)); 25 unwrap!(f.read_blocking(ADDR, &mut buf));
26 info!("Read: {=[u8]:x}", buf); 26 info!("Read: {=[u8]:x}", buf);
27 27
28 info!("Erasing..."); 28 info!("Erasing...");
29 unwrap!(f.erase(ADDR, ADDR + 128 * 1024)); 29 unwrap!(f.erase_blocking(ADDR, ADDR + 128 * 1024));
30 30
31 info!("Reading..."); 31 info!("Reading...");
32 let mut buf = [0u8; 32]; 32 let mut buf = [0u8; 32];
33 unwrap!(f.read(ADDR, &mut buf)); 33 unwrap!(f.read_blocking(ADDR, &mut buf));
34 info!("Read after erase: {=[u8]:x}", buf); 34 info!("Read after erase: {=[u8]:x}", buf);
35 35
36 info!("Writing..."); 36 info!("Writing...");
37 unwrap!(f.write( 37 unwrap!(f.write_blocking(
38 ADDR, 38 ADDR,
39 &[ 39 &[
40 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, 40 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) {
44 44
45 info!("Reading..."); 45 info!("Reading...");
46 let mut buf = [0u8; 32]; 46 let mut buf = [0u8; 32];
47 unwrap!(f.read(ADDR, &mut buf)); 47 unwrap!(f.read_blocking(ADDR, &mut buf));
48 info!("Read: {=[u8]:x}", buf); 48 info!("Read: {=[u8]:x}", buf);
49 assert_eq!( 49 assert_eq!(
50 &buf[..], 50 &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) {
14 14
15 const ADDR: u32 = 0x26000; 15 const ADDR: u32 = 0x26000;
16 16
17 let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() }; 17 let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
18 18
19 info!("Reading..."); 19 info!("Reading...");
20 let mut buf = [0u8; 8]; 20 let mut buf = [0u8; 8];
21 unwrap!(f.read(ADDR, &mut buf)); 21 unwrap!(f.read_blocking(ADDR, &mut buf));
22 info!("Read: {=[u8]:x}", buf); 22 info!("Read: {=[u8]:x}", buf);
23 23
24 info!("Erasing..."); 24 info!("Erasing...");
25 unwrap!(f.erase(ADDR, ADDR + 128)); 25 unwrap!(f.erase_blocking(ADDR, ADDR + 128));
26 26
27 info!("Reading..."); 27 info!("Reading...");
28 let mut buf = [0u8; 8]; 28 let mut buf = [0u8; 8];
29 unwrap!(f.read(ADDR, &mut buf)); 29 unwrap!(f.read_blocking(ADDR, &mut buf));
30 info!("Read after erase: {=[u8]:x}", buf); 30 info!("Read after erase: {=[u8]:x}", buf);
31 31
32 info!("Writing..."); 32 info!("Writing...");
33 unwrap!(f.write(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8])); 33 unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
34 34
35 info!("Reading..."); 35 info!("Reading...");
36 let mut buf = [0u8; 8]; 36 let mut buf = [0u8; 8];
37 unwrap!(f.read(ADDR, &mut buf)); 37 unwrap!(f.read_blocking(ADDR, &mut buf));
38 info!("Read: {=[u8]:x}", buf); 38 info!("Read: {=[u8]:x}", buf);
39 assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]); 39 assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
40} 40}
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) {
14 14
15 const ADDR: u32 = 0x26000; 15 const ADDR: u32 = 0x26000;
16 16
17 let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() }; 17 let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
18 18
19 info!("Reading..."); 19 info!("Reading...");
20 let mut buf = [0u8; 8]; 20 let mut buf = [0u8; 8];
21 unwrap!(f.read(ADDR, &mut buf)); 21 unwrap!(f.read_blocking(ADDR, &mut buf));
22 info!("Read: {=[u8]:x}", buf); 22 info!("Read: {=[u8]:x}", buf);
23 23
24 info!("Erasing..."); 24 info!("Erasing...");
25 unwrap!(f.erase(ADDR, ADDR + 256)); 25 unwrap!(f.erase_blocking(ADDR, ADDR + 256));
26 26
27 info!("Reading..."); 27 info!("Reading...");
28 let mut buf = [0u8; 8]; 28 let mut buf = [0u8; 8];
29 unwrap!(f.read(ADDR, &mut buf)); 29 unwrap!(f.read_blocking(ADDR, &mut buf));
30 info!("Read after erase: {=[u8]:x}", buf); 30 info!("Read after erase: {=[u8]:x}", buf);
31 31
32 info!("Writing..."); 32 info!("Writing...");
33 unwrap!(f.write(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8])); 33 unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
34 34
35 info!("Reading..."); 35 info!("Reading...");
36 let mut buf = [0u8; 8]; 36 let mut buf = [0u8; 8];
37 unwrap!(f.read(ADDR, &mut buf)); 37 unwrap!(f.read_blocking(ADDR, &mut buf));
38 info!("Read: {=[u8]:x}", buf); 38 info!("Read: {=[u8]:x}", buf);
39 assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]); 39 assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
40} 40}
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) {
14 14
15 const ADDR: u32 = 0x36000; 15 const ADDR: u32 = 0x36000;
16 16
17 let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() }; 17 let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
18 18
19 info!("Reading..."); 19 info!("Reading...");
20 let mut buf = [0u8; 8]; 20 let mut buf = [0u8; 8];
21 unwrap!(f.read(ADDR, &mut buf)); 21 unwrap!(f.read_blocking(ADDR, &mut buf));
22 info!("Read: {=[u8]:x}", buf); 22 info!("Read: {=[u8]:x}", buf);
23 23
24 info!("Erasing..."); 24 info!("Erasing...");
25 unwrap!(f.erase(ADDR, ADDR + 2048)); 25 unwrap!(f.erase_blocking(ADDR, ADDR + 2048));
26 26
27 info!("Reading..."); 27 info!("Reading...");
28 let mut buf = [0u8; 8]; 28 let mut buf = [0u8; 8];
29 unwrap!(f.read(ADDR, &mut buf)); 29 unwrap!(f.read_blocking(ADDR, &mut buf));
30 info!("Read: {=[u8]:x}", buf); 30 info!("Read: {=[u8]:x}", buf);
31 31
32 info!("Writing..."); 32 info!("Writing...");
33 unwrap!(f.write(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8])); 33 unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
34 34
35 info!("Reading..."); 35 info!("Reading...");
36 let mut buf = [0u8; 8]; 36 let mut buf = [0u8; 8];
37 unwrap!(f.read(ADDR, &mut buf)); 37 unwrap!(f.read_blocking(ADDR, &mut buf));
38 info!("Read: {=[u8]:x}", buf); 38 info!("Read: {=[u8]:x}", buf);
39 assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]); 39 assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
40} 40}