From 2758be8412b51bd2802d78b959f8381214431817 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Tue, 16 Mar 2021 13:26:51 +0100 Subject: [PATCH] adapt beginner material to BSP changes --- beginner/apps/src/bin/radio-puzzle-1.rs | 2 +- beginner/apps/src/bin/radio-puzzle-3.rs | 2 +- beginner/apps/src/bin/radio-puzzle-5.rs | 2 +- beginner/apps/src/bin/radio-puzzle-6.rs | 4 ++-- beginner/apps/src/bin/radio-puzzle-7.rs | 6 +++--- beginner/apps/src/bin/radio-puzzle-solution-2.rs | 6 +++--- beginner/apps/src/bin/radio-puzzle-solution.rs | 6 +++--- beginner/apps/src/bin/radio-puzzle.rs | 2 +- beginner/apps/src/bin/radio-recv.rs | 2 +- beginner/apps/src/bin/radio-send.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/beginner/apps/src/bin/radio-puzzle-1.rs b/beginner/apps/src/bin/radio-puzzle-1.rs index b4fdf1a..3c9ad08 100644 --- a/beginner/apps/src/bin/radio-puzzle-1.rs +++ b/beginner/apps/src/bin/radio-puzzle-1.rs @@ -29,7 +29,7 @@ fn main() -> ! { // single letter (byte) packet packet.copy_from_slice(&[source]); - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_ok() { // response should be one byte large diff --git a/beginner/apps/src/bin/radio-puzzle-3.rs b/beginner/apps/src/bin/radio-puzzle-3.rs index c35e1bb..845f0e9 100644 --- a/beginner/apps/src/bin/radio-puzzle-3.rs +++ b/beginner/apps/src/bin/radio-puzzle-3.rs @@ -26,7 +26,7 @@ fn main() -> ! { for source in b'A'..=b'B' { packet.copy_from_slice(&[source]); - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_ok() { // response should be one byte large diff --git a/beginner/apps/src/bin/radio-puzzle-5.rs b/beginner/apps/src/bin/radio-puzzle-5.rs index 8196c05..50dc9da 100644 --- a/beginner/apps/src/bin/radio-puzzle-5.rs +++ b/beginner/apps/src/bin/radio-puzzle-5.rs @@ -24,7 +24,7 @@ fn main() -> ! { /* # Retrieve the secret string */ packet.copy_from_slice(&[]); // empty packet - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_err() { log::error!("no response or response packet was corrupted"); diff --git a/beginner/apps/src/bin/radio-puzzle-6.rs b/beginner/apps/src/bin/radio-puzzle-6.rs index 2dd8588..4d9ca39 100644 --- a/beginner/apps/src/bin/radio-puzzle-6.rs +++ b/beginner/apps/src/bin/radio-puzzle-6.rs @@ -27,7 +27,7 @@ fn main() -> ! { for source in 0..=127 { packet.copy_from_slice(&[source]); - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_ok() { // response should be one byte large @@ -48,7 +48,7 @@ fn main() -> ! { /* # Retrieve the secret string */ packet.copy_from_slice(&[]); // empty packet - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_err() { log::error!("no response or response packet was corrupted"); diff --git a/beginner/apps/src/bin/radio-puzzle-7.rs b/beginner/apps/src/bin/radio-puzzle-7.rs index 7dbd3d2..933f0d9 100644 --- a/beginner/apps/src/bin/radio-puzzle-7.rs +++ b/beginner/apps/src/bin/radio-puzzle-7.rs @@ -27,7 +27,7 @@ fn main() -> ! { for source in 0..=127 { packet.copy_from_slice(&[source]); - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_ok() { // response should be one byte large @@ -48,7 +48,7 @@ fn main() -> ! { /* # Retrieve the secret string */ packet.copy_from_slice(&[]); // empty packet - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_err() { log::error!("no response or response packet was corrupted"); @@ -79,7 +79,7 @@ fn main() -> ! { /* # (NEW) Verify decrypted text */ packet.copy_from_slice(&buffer); - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_err() { log::error!("no response or response packet was corrupted"); diff --git a/beginner/apps/src/bin/radio-puzzle-solution-2.rs b/beginner/apps/src/bin/radio-puzzle-solution-2.rs index 72af2c5..385b632 100644 --- a/beginner/apps/src/bin/radio-puzzle-solution-2.rs +++ b/beginner/apps/src/bin/radio-puzzle-solution-2.rs @@ -27,7 +27,7 @@ fn main() -> ! { for plainletter in 0..=127 { packet.copy_from_slice(&[plainletter]); - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_ok() { // response should be one byte large @@ -48,7 +48,7 @@ fn main() -> ! { /* # Retrieve the secret string */ packet.copy_from_slice(&[]); // empty packet - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_err() { log::error!("no response or response packet was corrupted"); @@ -79,7 +79,7 @@ fn main() -> ! { ); /* # Verify decrypted text */ - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_err() { log::error!("no response or response packet was corrupted"); diff --git a/beginner/apps/src/bin/radio-puzzle-solution.rs b/beginner/apps/src/bin/radio-puzzle-solution.rs index 76d7a78..5808d5e 100644 --- a/beginner/apps/src/bin/radio-puzzle-solution.rs +++ b/beginner/apps/src/bin/radio-puzzle-solution.rs @@ -29,7 +29,7 @@ fn main() -> ! { // ^^^^^^^ NOTE complete ASCII range packet.copy_from_slice(&[plainletter]); - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_ok() { // response should be one byte large @@ -51,7 +51,7 @@ fn main() -> ! { /* # Retrieve the secret string */ packet.copy_from_slice(&[]); // empty packet - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_err() { log::error!("no response or response packet was corrupted"); @@ -83,7 +83,7 @@ fn main() -> ! { /* # Verify decrypted text */ packet.copy_from_slice(&buffer); - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_err() { log::error!("no response or response packet was corrupted"); diff --git a/beginner/apps/src/bin/radio-puzzle.rs b/beginner/apps/src/bin/radio-puzzle.rs index d071c0f..619905f 100644 --- a/beginner/apps/src/bin/radio-puzzle.rs +++ b/beginner/apps/src/bin/radio-puzzle.rs @@ -38,7 +38,7 @@ fn main() -> ! { str::from_utf8(msg).expect("msg was not valid UTF-8 data") ); - radio.send(&packet); + radio.send(&mut packet); if radio.recv_timeout(&mut packet, &mut timer, TEN_MS).is_ok() { log::info!( "received: {}", diff --git a/beginner/apps/src/bin/radio-recv.rs b/beginner/apps/src/bin/radio-recv.rs index 7116005..732f311 100644 --- a/beginner/apps/src/bin/radio-recv.rs +++ b/beginner/apps/src/bin/radio-recv.rs @@ -28,7 +28,7 @@ fn main() -> ! { "sending: {}", str::from_utf8(msg).expect("message is not valid UTF-8") ); - radio.send(&packet); + radio.send(&mut packet); // TODO try uncommenting this line // timer.delay(1_000); diff --git a/beginner/apps/src/bin/radio-send.rs b/beginner/apps/src/bin/radio-send.rs index 297ec15..4f411df 100644 --- a/beginner/apps/src/bin/radio-send.rs +++ b/beginner/apps/src/bin/radio-send.rs @@ -32,7 +32,7 @@ fn main() -> ! { packet.copy_from_slice(msg); - radio.send(&packet); + radio.send(&mut packet); dk::exit(); }