diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-08-18 13:12:19 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-08-18 13:21:21 +0200 |
| commit | b948e3776969ac488abb6507ce429fee33ceb48b (patch) | |
| tree | 5da36765d3e0b44b3fabb13ba9e8d620d25fb660 /tests | |
| parent | 94fa95c699df78c44750b63ba1a44c07802d0165 (diff) | |
rp/flash: change naming to `blocking_*`, `new_blocking`.
- Needed for consistency with other drivers.
- Having two `new()` functions sometimes resulted in 'multiple applicable methods' errors.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rp/src/bin/flash.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/rp/src/bin/flash.rs b/tests/rp/src/bin/flash.rs index 6e65fbdc0..75be2bf06 100644 --- a/tests/rp/src/bin/flash.rs +++ b/tests/rp/src/bin/flash.rs | |||
| @@ -25,23 +25,23 @@ async fn main(_spawner: Spawner) { | |||
| 25 | let mut flash = embassy_rp::flash::Flash::<_, Async, { 2 * 1024 * 1024 }>::new(p.FLASH, p.DMA_CH0); | 25 | let mut flash = embassy_rp::flash::Flash::<_, Async, { 2 * 1024 * 1024 }>::new(p.FLASH, p.DMA_CH0); |
| 26 | 26 | ||
| 27 | // Get JEDEC id | 27 | // Get JEDEC id |
| 28 | let jedec = defmt::unwrap!(flash.jedec_id()); | 28 | let jedec = defmt::unwrap!(flash.blocking_jedec_id()); |
| 29 | info!("jedec id: 0x{:x}", jedec); | 29 | info!("jedec id: 0x{:x}", jedec); |
| 30 | 30 | ||
| 31 | // Get unique id | 31 | // Get unique id |
| 32 | let mut uid = [0; 8]; | 32 | let mut uid = [0; 8]; |
| 33 | defmt::unwrap!(flash.unique_id(&mut uid)); | 33 | defmt::unwrap!(flash.blocking_unique_id(&mut uid)); |
| 34 | info!("unique id: {:?}", uid); | 34 | info!("unique id: {:?}", uid); |
| 35 | 35 | ||
| 36 | let mut buf = [0u8; ERASE_SIZE]; | 36 | let mut buf = [0u8; ERASE_SIZE]; |
| 37 | defmt::unwrap!(flash.read(ADDR_OFFSET, &mut buf)); | 37 | defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf)); |
| 38 | 38 | ||
| 39 | info!("Addr of flash block is {:x}", ADDR_OFFSET + FLASH_BASE as u32); | 39 | info!("Addr of flash block is {:x}", ADDR_OFFSET + FLASH_BASE as u32); |
| 40 | info!("Contents start with {=[u8]}", buf[0..4]); | 40 | info!("Contents start with {=[u8]}", buf[0..4]); |
| 41 | 41 | ||
| 42 | defmt::unwrap!(flash.erase(ADDR_OFFSET, ADDR_OFFSET + ERASE_SIZE as u32)); | 42 | defmt::unwrap!(flash.blocking_erase(ADDR_OFFSET, ADDR_OFFSET + ERASE_SIZE as u32)); |
| 43 | 43 | ||
| 44 | defmt::unwrap!(flash.read(ADDR_OFFSET, &mut buf)); | 44 | defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf)); |
| 45 | info!("Contents after erase starts with {=[u8]}", buf[0..4]); | 45 | info!("Contents after erase starts with {=[u8]}", buf[0..4]); |
| 46 | if buf.iter().any(|x| *x != 0xFF) { | 46 | if buf.iter().any(|x| *x != 0xFF) { |
| 47 | defmt::panic!("unexpected"); | 47 | defmt::panic!("unexpected"); |
| @@ -51,9 +51,9 @@ async fn main(_spawner: Spawner) { | |||
| 51 | *b = 0xDA; | 51 | *b = 0xDA; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | defmt::unwrap!(flash.write(ADDR_OFFSET, &mut buf)); | 54 | defmt::unwrap!(flash.blocking_write(ADDR_OFFSET, &mut buf)); |
| 55 | 55 | ||
| 56 | defmt::unwrap!(flash.read(ADDR_OFFSET, &mut buf)); | 56 | defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf)); |
| 57 | info!("Contents after write starts with {=[u8]}", buf[0..4]); | 57 | info!("Contents after write starts with {=[u8]}", buf[0..4]); |
| 58 | if buf.iter().any(|x| *x != 0xDA) { | 58 | if buf.iter().any(|x| *x != 0xDA) { |
| 59 | defmt::panic!("unexpected"); | 59 | defmt::panic!("unexpected"); |
