diff options
| author | Mathias <[email protected]> | 2022-10-27 07:10:27 +0200 |
|---|---|---|
| committer | Mathias <[email protected]> | 2022-10-27 07:10:35 +0200 |
| commit | 3c6c382465131c6f76567f976198b77e327df4b2 (patch) | |
| tree | 570c0cbf8b69fbc22c6ff81102d0cab31a9d84e9 /examples/rp/src/bin/flash.rs | |
| parent | 1669e395654430dff6dffda0cef9522f9ccfd213 (diff) | |
Remove random delay from example, and move flash functions to allow using without embedded-storage in scope
Diffstat (limited to 'examples/rp/src/bin/flash.rs')
| -rw-r--r-- | examples/rp/src/bin/flash.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/rp/src/bin/flash.rs b/examples/rp/src/bin/flash.rs index d4dfca759..8d6b379f4 100644 --- a/examples/rp/src/bin/flash.rs +++ b/examples/rp/src/bin/flash.rs | |||
| @@ -6,7 +6,7 @@ use defmt::*; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_rp::flash::{ERASE_SIZE, FLASH_BASE}; | 7 | use embassy_rp::flash::{ERASE_SIZE, FLASH_BASE}; |
| 8 | use embassy_rp::peripherals::FLASH; | 8 | use embassy_rp::peripherals::FLASH; |
| 9 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 9 | use embassy_time::{Duration, Timer}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| 11 | 11 | ||
| 12 | const ADDR_OFFSET: u32 = 0x100000; | 12 | const ADDR_OFFSET: u32 = 0x100000; |
| @@ -17,6 +17,12 @@ async fn main(_spawner: Spawner) { | |||
| 17 | let p = embassy_rp::init(Default::default()); | 17 | let p = embassy_rp::init(Default::default()); |
| 18 | info!("Hello World!"); | 18 | info!("Hello World!"); |
| 19 | 19 | ||
| 20 | // add some delay to give an attached debug probe time to parse the | ||
| 21 | // defmt RTT header. Reading that header might touch flash memory, which | ||
| 22 | // interferes with flash write operations. | ||
| 23 | // https://github.com/knurling-rs/defmt/pull/683 | ||
| 24 | Timer::after(Duration::from_millis(10)).await; | ||
| 25 | |||
| 20 | let mut flash = embassy_rp::flash::Flash::<_, FLASH_SIZE>::new(p.FLASH); | 26 | let mut flash = embassy_rp::flash::Flash::<_, FLASH_SIZE>::new(p.FLASH); |
| 21 | erase_write_sector(&mut flash, 0x00); | 27 | erase_write_sector(&mut flash, 0x00); |
| 22 | 28 | ||
