aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-09-30 11:32:27 +0000
committerGitHub <[email protected]>2022-09-30 11:32:27 +0000
commitaabc02506bcbd762552660a0b45cda6e15787cab (patch)
tree253c93c3a496dd960bfea5a0b7ff950c8be52509 /examples
parent99284b830455dde9cd91091e2c1f4dda92936f51 (diff)
parenta7fdeac560b5e277afa80cd60f788a48df6069c9 (diff)
Merge #992
992: (embassy-stm32): remove flash lock/unlock public API from stm32 flash r=lulf a=MathiasKoch Instead, perform the unlocking and locking automatically on erase and write operations. This makes the `embedded-storage` abstraction actually useable in libraries, while still keeping the flash peripheral locked the majority of the time. Co-authored-by: Mathias <[email protected]>
Diffstat (limited to 'examples')
-rw-r--r--examples/boot/application/stm32f3/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32f7/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32h7/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32l0/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32l1/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32l4/src/bin/a.rs2
-rw-r--r--examples/boot/application/stm32wl/src/bin/a.rs2
-rw-r--r--examples/boot/bootloader/stm32/src/main.rs2
-rw-r--r--examples/stm32f3/src/bin/flash.rs2
-rw-r--r--examples/stm32f4/src/bin/flash.rs2
-rw-r--r--examples/stm32f7/src/bin/flash.rs2
-rw-r--r--examples/stm32h7/src/bin/flash.rs2
-rw-r--r--examples/stm32l0/src/bin/flash.rs2
-rw-r--r--examples/stm32l1/src/bin/flash.rs2
-rw-r--r--examples/stm32wl/src/bin/flash.rs2
15 files changed, 15 insertions, 15 deletions
diff --git a/examples/boot/application/stm32f3/src/bin/a.rs b/examples/boot/application/stm32f3/src/bin/a.rs
index fdbd5ab99..d92d59b29 100644
--- a/examples/boot/application/stm32f3/src/bin/a.rs
+++ b/examples/boot/application/stm32f3/src/bin/a.rs
@@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
17#[embassy_executor::main] 17#[embassy_executor::main]
18async fn main(_spawner: Spawner) { 18async fn main(_spawner: Spawner) {
19 let p = embassy_stm32::init(Default::default()); 19 let p = embassy_stm32::init(Default::default());
20 let flash = Flash::unlock(p.FLASH); 20 let flash = Flash::new(p.FLASH);
21 let mut flash = BlockingAsync::new(flash); 21 let mut flash = BlockingAsync::new(flash);
22 22
23 let button = Input::new(p.PC13, Pull::Up); 23 let button = Input::new(p.PC13, Pull::Up);
diff --git a/examples/boot/application/stm32f7/src/bin/a.rs b/examples/boot/application/stm32f7/src/bin/a.rs
index 77b897b0f..79ab80e09 100644
--- a/examples/boot/application/stm32f7/src/bin/a.rs
+++ b/examples/boot/application/stm32f7/src/bin/a.rs
@@ -16,7 +16,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
16#[embassy_executor::main] 16#[embassy_executor::main]
17async fn main(_spawner: Spawner) { 17async fn main(_spawner: Spawner) {
18 let p = embassy_stm32::init(Default::default()); 18 let p = embassy_stm32::init(Default::default());
19 let mut flash = Flash::unlock(p.FLASH); 19 let mut flash = Flash::new(p.FLASH);
20 20
21 let button = Input::new(p.PC13, Pull::Down); 21 let button = Input::new(p.PC13, Pull::Down);
22 let mut button = ExtiInput::new(button, p.EXTI13); 22 let mut button = ExtiInput::new(button, p.EXTI13);
diff --git a/examples/boot/application/stm32h7/src/bin/a.rs b/examples/boot/application/stm32h7/src/bin/a.rs
index 0fe598a5d..8b452be34 100644
--- a/examples/boot/application/stm32h7/src/bin/a.rs
+++ b/examples/boot/application/stm32h7/src/bin/a.rs
@@ -16,7 +16,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
16#[embassy_executor::main] 16#[embassy_executor::main]
17async fn main(_spawner: Spawner) { 17async fn main(_spawner: Spawner) {
18 let p = embassy_stm32::init(Default::default()); 18 let p = embassy_stm32::init(Default::default());
19 let mut flash = Flash::unlock(p.FLASH); 19 let mut flash = Flash::new(p.FLASH);
20 20
21 let button = Input::new(p.PC13, Pull::Down); 21 let button = Input::new(p.PC13, Pull::Down);
22 let mut button = ExtiInput::new(button, p.EXTI13); 22 let mut button = ExtiInput::new(button, p.EXTI13);
diff --git a/examples/boot/application/stm32l0/src/bin/a.rs b/examples/boot/application/stm32l0/src/bin/a.rs
index f0b0b80e3..59ca34386 100644
--- a/examples/boot/application/stm32l0/src/bin/a.rs
+++ b/examples/boot/application/stm32l0/src/bin/a.rs
@@ -18,7 +18,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
18#[embassy_executor::main] 18#[embassy_executor::main]
19async fn main(_spawner: Spawner) { 19async fn main(_spawner: Spawner) {
20 let p = embassy_stm32::init(Default::default()); 20 let p = embassy_stm32::init(Default::default());
21 let flash = Flash::unlock(p.FLASH); 21 let flash = Flash::new(p.FLASH);
22 let mut flash = BlockingAsync::new(flash); 22 let mut flash = BlockingAsync::new(flash);
23 23
24 let button = Input::new(p.PB2, Pull::Up); 24 let button = Input::new(p.PB2, Pull::Up);
diff --git a/examples/boot/application/stm32l1/src/bin/a.rs b/examples/boot/application/stm32l1/src/bin/a.rs
index f0b0b80e3..59ca34386 100644
--- a/examples/boot/application/stm32l1/src/bin/a.rs
+++ b/examples/boot/application/stm32l1/src/bin/a.rs
@@ -18,7 +18,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
18#[embassy_executor::main] 18#[embassy_executor::main]
19async fn main(_spawner: Spawner) { 19async fn main(_spawner: Spawner) {
20 let p = embassy_stm32::init(Default::default()); 20 let p = embassy_stm32::init(Default::default());
21 let flash = Flash::unlock(p.FLASH); 21 let flash = Flash::new(p.FLASH);
22 let mut flash = BlockingAsync::new(flash); 22 let mut flash = BlockingAsync::new(flash);
23 23
24 let button = Input::new(p.PB2, Pull::Up); 24 let button = Input::new(p.PB2, Pull::Up);
diff --git a/examples/boot/application/stm32l4/src/bin/a.rs b/examples/boot/application/stm32l4/src/bin/a.rs
index 5119bad2e..6cddc6cc8 100644
--- a/examples/boot/application/stm32l4/src/bin/a.rs
+++ b/examples/boot/application/stm32l4/src/bin/a.rs
@@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
17#[embassy_executor::main] 17#[embassy_executor::main]
18async fn main(_spawner: Spawner) { 18async fn main(_spawner: Spawner) {
19 let p = embassy_stm32::init(Default::default()); 19 let p = embassy_stm32::init(Default::default());
20 let flash = Flash::unlock(p.FLASH); 20 let flash = Flash::new(p.FLASH);
21 let mut flash = BlockingAsync::new(flash); 21 let mut flash = BlockingAsync::new(flash);
22 22
23 let button = Input::new(p.PC13, Pull::Up); 23 let button = Input::new(p.PC13, Pull::Up);
diff --git a/examples/boot/application/stm32wl/src/bin/a.rs b/examples/boot/application/stm32wl/src/bin/a.rs
index faa650778..1ff47eddd 100644
--- a/examples/boot/application/stm32wl/src/bin/a.rs
+++ b/examples/boot/application/stm32wl/src/bin/a.rs
@@ -17,7 +17,7 @@ static APP_B: &[u8] = include_bytes!("../../b.bin");
17#[embassy_executor::main] 17#[embassy_executor::main]
18async fn main(_spawner: Spawner) { 18async fn main(_spawner: Spawner) {
19 let p = embassy_stm32::init(Default::default()); 19 let p = embassy_stm32::init(Default::default());
20 let flash = Flash::unlock(p.FLASH); 20 let flash = Flash::new(p.FLASH);
21 let mut flash = BlockingAsync::new(flash); 21 let mut flash = BlockingAsync::new(flash);
22 22
23 let button = Input::new(p.PA0, Pull::Up); 23 let button = Input::new(p.PA0, Pull::Up);
diff --git a/examples/boot/bootloader/stm32/src/main.rs b/examples/boot/bootloader/stm32/src/main.rs
index 294464d1c..4b17cd799 100644
--- a/examples/boot/bootloader/stm32/src/main.rs
+++ b/examples/boot/bootloader/stm32/src/main.rs
@@ -20,7 +20,7 @@ fn main() -> ! {
20 */ 20 */
21 21
22 let mut bl: BootLoader<ERASE_SIZE, WRITE_SIZE> = BootLoader::default(); 22 let mut bl: BootLoader<ERASE_SIZE, WRITE_SIZE> = BootLoader::default();
23 let flash = Flash::unlock(p.FLASH); 23 let flash = Flash::new(p.FLASH);
24 let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash); 24 let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash);
25 let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash)); 25 let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
26 core::mem::drop(flash); 26 core::mem::drop(flash);
diff --git a/examples/stm32f3/src/bin/flash.rs b/examples/stm32f3/src/bin/flash.rs
index 2cf24dbd3..baa7484d0 100644
--- a/examples/stm32f3/src/bin/flash.rs
+++ b/examples/stm32f3/src/bin/flash.rs
@@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
15 15
16 const ADDR: u32 = 0x26000; 16 const ADDR: u32 = 0x26000;
17 17
18 let mut f = Flash::unlock(p.FLASH); 18 let mut f = Flash::new(p.FLASH);
19 19
20 info!("Reading..."); 20 info!("Reading...");
21 let mut buf = [0u8; 8]; 21 let mut buf = [0u8; 8];
diff --git a/examples/stm32f4/src/bin/flash.rs b/examples/stm32f4/src/bin/flash.rs
index 393d61e86..7ea068a42 100644
--- a/examples/stm32f4/src/bin/flash.rs
+++ b/examples/stm32f4/src/bin/flash.rs
@@ -13,7 +13,7 @@ async fn main(_spawner: Spawner) {
13 let p = embassy_stm32::init(Default::default()); 13 let p = embassy_stm32::init(Default::default());
14 info!("Hello Flash!"); 14 info!("Hello Flash!");
15 15
16 let mut f = Flash::unlock(p.FLASH); 16 let mut f = Flash::new(p.FLASH);
17 17
18 // Sector 5 18 // Sector 5
19 test_flash(&mut f, 128 * 1024, 128 * 1024); 19 test_flash(&mut f, 128 * 1024, 128 * 1024);
diff --git a/examples/stm32f7/src/bin/flash.rs b/examples/stm32f7/src/bin/flash.rs
index c10781d0c..4a7bca1fa 100644
--- a/examples/stm32f7/src/bin/flash.rs
+++ b/examples/stm32f7/src/bin/flash.rs
@@ -19,7 +19,7 @@ async fn main(_spawner: Spawner) {
19 // wait a bit before accessing the flash 19 // wait a bit before accessing the flash
20 Timer::after(Duration::from_millis(300)).await; 20 Timer::after(Duration::from_millis(300)).await;
21 21
22 let mut f = Flash::unlock(p.FLASH); 22 let mut f = Flash::new(p.FLASH);
23 23
24 info!("Reading..."); 24 info!("Reading...");
25 let mut buf = [0u8; 32]; 25 let mut buf = [0u8; 32];
diff --git a/examples/stm32h7/src/bin/flash.rs b/examples/stm32h7/src/bin/flash.rs
index 6682c64d5..ee86bdbf6 100644
--- a/examples/stm32h7/src/bin/flash.rs
+++ b/examples/stm32h7/src/bin/flash.rs
@@ -19,7 +19,7 @@ async fn main(_spawner: Spawner) {
19 // wait a bit before accessing the flash 19 // wait a bit before accessing the flash
20 Timer::after(Duration::from_millis(300)).await; 20 Timer::after(Duration::from_millis(300)).await;
21 21
22 let mut f = Flash::unlock(p.FLASH); 22 let mut f = Flash::new(p.FLASH);
23 23
24 info!("Reading..."); 24 info!("Reading...");
25 let mut buf = [0u8; 32]; 25 let mut buf = [0u8; 32];
diff --git a/examples/stm32l0/src/bin/flash.rs b/examples/stm32l0/src/bin/flash.rs
index 867cb4d3e..ffe4fb10b 100644
--- a/examples/stm32l0/src/bin/flash.rs
+++ b/examples/stm32l0/src/bin/flash.rs
@@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
15 15
16 const ADDR: u32 = 0x26000; 16 const ADDR: u32 = 0x26000;
17 17
18 let mut f = Flash::unlock(p.FLASH); 18 let mut f = Flash::new(p.FLASH);
19 19
20 info!("Reading..."); 20 info!("Reading...");
21 let mut buf = [0u8; 8]; 21 let mut buf = [0u8; 8];
diff --git a/examples/stm32l1/src/bin/flash.rs b/examples/stm32l1/src/bin/flash.rs
index a76b9879f..476ed51a4 100644
--- a/examples/stm32l1/src/bin/flash.rs
+++ b/examples/stm32l1/src/bin/flash.rs
@@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
15 15
16 const ADDR: u32 = 0x26000; 16 const ADDR: u32 = 0x26000;
17 17
18 let mut f = Flash::unlock(p.FLASH); 18 let mut f = Flash::new(p.FLASH);
19 19
20 info!("Reading..."); 20 info!("Reading...");
21 let mut buf = [0u8; 8]; 21 let mut buf = [0u8; 8];
diff --git a/examples/stm32wl/src/bin/flash.rs b/examples/stm32wl/src/bin/flash.rs
index eb7489760..2a8880624 100644
--- a/examples/stm32wl/src/bin/flash.rs
+++ b/examples/stm32wl/src/bin/flash.rs
@@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
15 15
16 const ADDR: u32 = 0x36000; 16 const ADDR: u32 = 0x36000;
17 17
18 let mut f = Flash::unlock(p.FLASH); 18 let mut f = Flash::new(p.FLASH);
19 19
20 info!("Reading..."); 20 info!("Reading...");
21 let mut buf = [0u8; 8]; 21 let mut buf = [0u8; 8];