Add stringify function
This commit is contained in:
parent
e3492862e9
commit
f34829f534
1 changed files with 9 additions and 1 deletions
|
@ -18,6 +18,9 @@ use embedded_io::asynch::Write;
|
|||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
use heapless::String;
|
||||
|
||||
|
||||
macro_rules! singleton {
|
||||
($val:expr) => {{
|
||||
type T = impl Sized;
|
||||
|
@ -129,7 +132,8 @@ async fn main(spawner: Spawner) {
|
|||
}
|
||||
};
|
||||
|
||||
info!("rxd {:02x}", &buf[..n]);
|
||||
info!("rxd {}", asciify(&buf[..n]));
|
||||
|
||||
|
||||
match socket.write_all(&buf[..n]).await {
|
||||
Ok(()) => {}
|
||||
|
@ -214,3 +218,7 @@ impl SpiBusWrite<u32> for MySpi {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn asciify(buf: &[u8],) -> String<4096> {
|
||||
buf.into_iter().map(|c| *c as char).into_iter().collect()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue