Fix examples

This commit is contained in:
Rasmus Melchior Jacobsen 2023-05-25 22:36:56 +02:00
parent b50d04336e
commit 8938d928f8
7 changed files with 32 additions and 32 deletions

View File

@ -18,23 +18,23 @@ async fn main(_spawner: Spawner) {
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 8]; let mut buf = [0u8; 8];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
info!("Erasing..."); info!("Erasing...");
unwrap!(f.erase_blocking(ADDR, ADDR + 2048)); unwrap!(f.blocking_erase(ADDR, ADDR + 2048));
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 8]; let mut buf = [0u8; 8];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read after erase: {=[u8]:x}", buf); info!("Read after erase: {=[u8]:x}", buf);
info!("Writing..."); info!("Writing...");
unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8])); unwrap!(f.blocking_write(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_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(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]);
} }

View File

@ -35,7 +35,7 @@ fn test_flash(f: &mut Flash, offset: u32, size: u32) {
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
info!("Erasing..."); info!("Erasing...");
unwrap!(f.erase_blocking(offset, offset + size)); unwrap!(f.blocking_erase(offset, offset + size));
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 32]; let mut buf = [0u8; 32];
@ -43,7 +43,7 @@ fn test_flash(f: &mut Flash, offset: u32, size: u32) {
info!("Read after erase: {=[u8]:x}", buf); info!("Read after erase: {=[u8]:x}", buf);
info!("Writing..."); info!("Writing...");
unwrap!(f.write_blocking( unwrap!(f.blocking_write(
offset, offset,
&[ &[
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,

View File

@ -22,19 +22,19 @@ async fn main(_spawner: Spawner) {
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 32]; let mut buf = [0u8; 32];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
info!("Erasing..."); info!("Erasing...");
unwrap!(f.erase_blocking(ADDR, ADDR + 256 * 1024)); unwrap!(f.blocking_erase(ADDR, ADDR + 256 * 1024));
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 32]; let mut buf = [0u8; 32];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read after erase: {=[u8]:x}", buf); info!("Read after erase: {=[u8]:x}", buf);
info!("Writing..."); info!("Writing...");
unwrap!(f.write_blocking( unwrap!(f.blocking_write(
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_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
assert_eq!( assert_eq!(
&buf[..], &buf[..],

View File

@ -22,19 +22,19 @@ async fn main(_spawner: Spawner) {
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 32]; let mut buf = [0u8; 32];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
info!("Erasing..."); info!("Erasing...");
unwrap!(f.erase_blocking(ADDR, ADDR + 128 * 1024)); unwrap!(f.blocking_erase(ADDR, ADDR + 128 * 1024));
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 32]; let mut buf = [0u8; 32];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read after erase: {=[u8]:x}", buf); info!("Read after erase: {=[u8]:x}", buf);
info!("Writing..."); info!("Writing...");
unwrap!(f.write_blocking( unwrap!(f.blocking_write(
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_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
assert_eq!( assert_eq!(
&buf[..], &buf[..],

View File

@ -18,23 +18,23 @@ async fn main(_spawner: Spawner) {
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 8]; let mut buf = [0u8; 8];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
info!("Erasing..."); info!("Erasing...");
unwrap!(f.erase_blocking(ADDR, ADDR + 128)); unwrap!(f.blocking_erase(ADDR, ADDR + 128));
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 8]; let mut buf = [0u8; 8];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read after erase: {=[u8]:x}", buf); info!("Read after erase: {=[u8]:x}", buf);
info!("Writing..."); info!("Writing...");
unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8])); unwrap!(f.blocking_write(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_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(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]);
} }

View File

@ -18,23 +18,23 @@ async fn main(_spawner: Spawner) {
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 8]; let mut buf = [0u8; 8];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
info!("Erasing..."); info!("Erasing...");
unwrap!(f.erase_blocking(ADDR, ADDR + 256)); unwrap!(f.blocking_erase(ADDR, ADDR + 256));
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 8]; let mut buf = [0u8; 8];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read after erase: {=[u8]:x}", buf); info!("Read after erase: {=[u8]:x}", buf);
info!("Writing..."); info!("Writing...");
unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8])); unwrap!(f.blocking_write(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_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(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]);
} }

View File

@ -18,23 +18,23 @@ async fn main(_spawner: Spawner) {
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 8]; let mut buf = [0u8; 8];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
info!("Erasing..."); info!("Erasing...");
unwrap!(f.erase_blocking(ADDR, ADDR + 2048)); unwrap!(f.blocking_erase(ADDR, ADDR + 2048));
info!("Reading..."); info!("Reading...");
let mut buf = [0u8; 8]; let mut buf = [0u8; 8];
unwrap!(f.read_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(ADDR, &mut buf));
info!("Read: {=[u8]:x}", buf); info!("Read: {=[u8]:x}", buf);
info!("Writing..."); info!("Writing...");
unwrap!(f.write_blocking(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8])); unwrap!(f.blocking_write(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_blocking(ADDR, &mut buf)); unwrap!(f.blocking_read(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]);
} }