Add from_utf8
This commit is contained in:
parent
f34829f534
commit
f6f041b05d
@ -18,8 +18,7 @@ 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 heapless::String;
|
use core::str::from_utf8;
|
||||||
|
|
||||||
|
|
||||||
macro_rules! singleton {
|
macro_rules! singleton {
|
||||||
($val:expr) => {{
|
($val:expr) => {{
|
||||||
@ -132,7 +131,7 @@ async fn main(spawner: Spawner) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
info!("rxd {}", asciify(&buf[..n]));
|
info!("rxd {}", from_utf8(&buf[..n]).unwrap());
|
||||||
|
|
||||||
|
|
||||||
match socket.write_all(&buf[..n]).await {
|
match socket.write_all(&buf[..n]).await {
|
||||||
@ -218,7 +217,3 @@ impl SpiBusWrite<u32> for MySpi {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn asciify(buf: &[u8],) -> String<4096> {
|
|
||||||
buf.into_iter().map(|c| *c as char).into_iter().collect()
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user