i can read HW uart in the terminal via info

This commit is contained in:
Priec
2025-11-11 22:34:16 +01:00
parent 347d10fb27
commit c1d0fa9d04

View File

@@ -44,7 +44,7 @@ async fn main(spawner: Spawner) {
// HARDWARE UART to the PC
let mut cfg = Config::default();
cfg.baudrate = 230_400;
cfg.baudrate = BAUD;
static TX_BUF: StaticCell<[u8; 256]> = StaticCell::new();
static RX_BUF: StaticCell<[u8; 256]> = StaticCell::new();
let uart = BufferedUart::new(
@@ -79,14 +79,19 @@ async fn main(spawner: Spawner) {
// EDN OF SOFTWARE UART
let mut last_yield = Instant::now();
let mut buf = [0u8; 32];
loop {
info!("tick start");
// Timer::after(Duration::from_millis(100)).await;
// info!("tick end");
let n = handle.rx.read(&mut buf).await;
if n > 0 {
info!("PC received: {:a}", &buf[..n]);
}
if Instant::now().duration_since(last_yield) >= handle.yield_period {
embassy_futures::yield_now().await;
yield_now().await;
last_yield = Instant::now();
}