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.
This commit is contained in:
@ -25,23 +25,23 @@ async fn main(_spawner: Spawner) {
|
||||
let mut flash = embassy_rp::flash::Flash::<_, Async, { 2 * 1024 * 1024 }>::new(p.FLASH, p.DMA_CH0);
|
||||
|
||||
// Get JEDEC id
|
||||
let jedec = defmt::unwrap!(flash.jedec_id());
|
||||
let jedec = defmt::unwrap!(flash.blocking_jedec_id());
|
||||
info!("jedec id: 0x{:x}", jedec);
|
||||
|
||||
// Get unique id
|
||||
let mut uid = [0; 8];
|
||||
defmt::unwrap!(flash.unique_id(&mut uid));
|
||||
defmt::unwrap!(flash.blocking_unique_id(&mut uid));
|
||||
info!("unique id: {:?}", uid);
|
||||
|
||||
let mut buf = [0u8; ERASE_SIZE];
|
||||
defmt::unwrap!(flash.read(ADDR_OFFSET, &mut buf));
|
||||
defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf));
|
||||
|
||||
info!("Addr of flash block is {:x}", ADDR_OFFSET + FLASH_BASE as u32);
|
||||
info!("Contents start with {=[u8]}", buf[0..4]);
|
||||
|
||||
defmt::unwrap!(flash.erase(ADDR_OFFSET, ADDR_OFFSET + ERASE_SIZE as u32));
|
||||
defmt::unwrap!(flash.blocking_erase(ADDR_OFFSET, ADDR_OFFSET + ERASE_SIZE as u32));
|
||||
|
||||
defmt::unwrap!(flash.read(ADDR_OFFSET, &mut buf));
|
||||
defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf));
|
||||
info!("Contents after erase starts with {=[u8]}", buf[0..4]);
|
||||
if buf.iter().any(|x| *x != 0xFF) {
|
||||
defmt::panic!("unexpected");
|
||||
@ -51,9 +51,9 @@ async fn main(_spawner: Spawner) {
|
||||
*b = 0xDA;
|
||||
}
|
||||
|
||||
defmt::unwrap!(flash.write(ADDR_OFFSET, &mut buf));
|
||||
defmt::unwrap!(flash.blocking_write(ADDR_OFFSET, &mut buf));
|
||||
|
||||
defmt::unwrap!(flash.read(ADDR_OFFSET, &mut buf));
|
||||
defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf));
|
||||
info!("Contents after write starts with {=[u8]}", buf[0..4]);
|
||||
if buf.iter().any(|x| *x != 0xDA) {
|
||||
defmt::panic!("unexpected");
|
||||
|
Reference in New Issue
Block a user