aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-03-14 18:42:27 +0100
committerGitHub <[email protected]>2023-03-14 18:42:27 +0100
commite33b99e9ec9902d6f93582530fd9cfe38953ce69 (patch)
tree21fc5b9b1b9f9fd6b2d38e00ac4da2758cf65c28
parente3492862e994b0c46b23b486cae2935c2c0e05a0 (diff)
parentf6f041b05d9702982e3cf56bb76f7904485677c8 (diff)
Merge pull request #40 from Slushee-a/master
Add from_utf8 for a clearer example
-rw-r--r--examples/rpi-pico-w/src/main.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/rpi-pico-w/src/main.rs b/examples/rpi-pico-w/src/main.rs
index 71459a122..c706e121d 100644
--- a/examples/rpi-pico-w/src/main.rs
+++ b/examples/rpi-pico-w/src/main.rs
@@ -1,4 +1,4 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3#![feature(type_alias_impl_trait)] 3#![feature(type_alias_impl_trait)]
4#![feature(async_fn_in_trait)] 4#![feature(async_fn_in_trait)]
@@ -18,6 +18,8 @@ use embedded_io::asynch::Write;
18use static_cell::StaticCell; 18use static_cell::StaticCell;
19use {defmt_rtt as _, panic_probe as _}; 19use {defmt_rtt as _, panic_probe as _};
20 20
21use core::str::from_utf8;
22
21macro_rules! singleton { 23macro_rules! singleton {
22 ($val:expr) => {{ 24 ($val:expr) => {{
23 type T = impl Sized; 25 type T = impl Sized;
@@ -129,7 +131,8 @@ async fn main(spawner: Spawner) {
129 } 131 }
130 }; 132 };
131 133
132 info!("rxd {:02x}", &buf[..n]); 134 info!("rxd {}", from_utf8(&buf[..n]).unwrap());
135
133 136
134 match socket.write_all(&buf[..n]).await { 137 match socket.write_all(&buf[..n]).await {
135 Ok(()) => {} 138 Ok(()) => {}