Merge pull request #40 from Slushee-a/master
Add from_utf8 for a clearer example
This commit is contained in:
commit
e33b99e9ec
1 changed files with 5 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
|
@ -18,6 +18,8 @@ use embedded_io::asynch::Write;
|
||||||
use static_cell::StaticCell;
|
use static_cell::StaticCell;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
|
use core::str::from_utf8;
|
||||||
|
|
||||||
macro_rules! singleton {
|
macro_rules! singleton {
|
||||||
($val:expr) => {{
|
($val:expr) => {{
|
||||||
type T = impl Sized;
|
type T = impl Sized;
|
||||||
|
@ -129,7 +131,8 @@ async fn main(spawner: Spawner) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
info!("rxd {:02x}", &buf[..n]);
|
info!("rxd {}", from_utf8(&buf[..n]).unwrap());
|
||||||
|
|
||||||
|
|
||||||
match socket.write_all(&buf[..n]).await {
|
match socket.write_all(&buf[..n]).await {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
|
|
Loading…
Reference in a new issue