Align examples
This commit is contained in:
parent
dfd5603171
commit
8b13a7b338
@ -14,27 +14,27 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
const ADDR: u32 = 0x26000;
|
const ADDR: u32 = 0x26000;
|
||||||
|
|
||||||
let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() };
|
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Erasing...");
|
info!("Erasing...");
|
||||||
unwrap!(f.erase(ADDR, ADDR + 2048));
|
unwrap!(f.erase_blocking(ADDR, ADDR + 2048));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read after erase: {=[u8]:x}", buf);
|
info!("Read after erase: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Writing...");
|
info!("Writing...");
|
||||||
unwrap!(f.write(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
|
unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
|
assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
}
|
}
|
||||||
|
@ -18,23 +18,23 @@ async fn main(_spawner: Spawner) {
|
|||||||
// wait a bit before accessing the flash
|
// wait a bit before accessing the flash
|
||||||
Timer::after(Duration::from_millis(300)).await;
|
Timer::after(Duration::from_millis(300)).await;
|
||||||
|
|
||||||
let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region3.into_blocking() };
|
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region3;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 32];
|
let mut buf = [0u8; 32];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Erasing...");
|
info!("Erasing...");
|
||||||
unwrap!(f.erase(ADDR, ADDR + 256 * 1024));
|
unwrap!(f.erase_blocking(ADDR, ADDR + 256 * 1024));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 32];
|
let mut buf = [0u8; 32];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read after erase: {=[u8]:x}", buf);
|
info!("Read after erase: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Writing...");
|
info!("Writing...");
|
||||||
unwrap!(f.write(
|
unwrap!(f.write_blocking(
|
||||||
ADDR,
|
ADDR,
|
||||||
&[
|
&[
|
||||||
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,
|
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) {
|
|||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 32];
|
let mut buf = [0u8; 32];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
&buf[..],
|
&buf[..],
|
||||||
|
@ -18,23 +18,23 @@ async fn main(_spawner: Spawner) {
|
|||||||
// wait a bit before accessing the flash
|
// wait a bit before accessing the flash
|
||||||
Timer::after(Duration::from_millis(300)).await;
|
Timer::after(Duration::from_millis(300)).await;
|
||||||
|
|
||||||
let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank2_region.into_blocking() };
|
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank2_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 32];
|
let mut buf = [0u8; 32];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Erasing...");
|
info!("Erasing...");
|
||||||
unwrap!(f.erase(ADDR, ADDR + 128 * 1024));
|
unwrap!(f.erase_blocking(ADDR, ADDR + 128 * 1024));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 32];
|
let mut buf = [0u8; 32];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read after erase: {=[u8]:x}", buf);
|
info!("Read after erase: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Writing...");
|
info!("Writing...");
|
||||||
unwrap!(f.write(
|
unwrap!(f.write_blocking(
|
||||||
ADDR,
|
ADDR,
|
||||||
&[
|
&[
|
||||||
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,
|
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) {
|
|||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 32];
|
let mut buf = [0u8; 32];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
&buf[..],
|
&buf[..],
|
||||||
|
@ -14,27 +14,27 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
const ADDR: u32 = 0x26000;
|
const ADDR: u32 = 0x26000;
|
||||||
|
|
||||||
let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() };
|
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Erasing...");
|
info!("Erasing...");
|
||||||
unwrap!(f.erase(ADDR, ADDR + 128));
|
unwrap!(f.erase_blocking(ADDR, ADDR + 128));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read after erase: {=[u8]:x}", buf);
|
info!("Read after erase: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Writing...");
|
info!("Writing...");
|
||||||
unwrap!(f.write(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
|
unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
|
assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
}
|
}
|
||||||
|
@ -14,27 +14,27 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
const ADDR: u32 = 0x26000;
|
const ADDR: u32 = 0x26000;
|
||||||
|
|
||||||
let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() };
|
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Erasing...");
|
info!("Erasing...");
|
||||||
unwrap!(f.erase(ADDR, ADDR + 256));
|
unwrap!(f.erase_blocking(ADDR, ADDR + 256));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read after erase: {=[u8]:x}", buf);
|
info!("Read after erase: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Writing...");
|
info!("Writing...");
|
||||||
unwrap!(f.write(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
|
unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
|
assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
}
|
}
|
||||||
|
@ -14,27 +14,27 @@ async fn main(_spawner: Spawner) {
|
|||||||
|
|
||||||
const ADDR: u32 = 0x36000;
|
const ADDR: u32 = 0x36000;
|
||||||
|
|
||||||
let mut f = unsafe { Flash::new(p.FLASH, interrupt::take!(FLASH)).into_regions().bank1_region.into_blocking() };
|
let mut f = Flash::new(p.FLASH, interrupt::take!(FLASH)).into_blocking_regions().bank1_region;
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Erasing...");
|
info!("Erasing...");
|
||||||
unwrap!(f.erase(ADDR, ADDR + 2048));
|
unwrap!(f.erase_blocking(ADDR, ADDR + 2048));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
|
|
||||||
info!("Writing...");
|
info!("Writing...");
|
||||||
unwrap!(f.write(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
|
unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
|
||||||
|
|
||||||
info!("Reading...");
|
info!("Reading...");
|
||||||
let mut buf = [0u8; 8];
|
let mut buf = [0u8; 8];
|
||||||
unwrap!(f.read(ADDR, &mut buf));
|
unwrap!(f.read_blocking(ADDR, &mut buf));
|
||||||
info!("Read: {=[u8]:x}", buf);
|
info!("Read: {=[u8]:x}", buf);
|
||||||
assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
|
assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user