i can read HW uart in the terminal via info
This commit is contained in:
@@ -44,7 +44,7 @@ async fn main(spawner: Spawner) {
|
|||||||
// HARDWARE UART to the PC
|
// HARDWARE UART to the PC
|
||||||
|
|
||||||
let mut cfg = Config::default();
|
let mut cfg = Config::default();
|
||||||
cfg.baudrate = 230_400;
|
cfg.baudrate = BAUD;
|
||||||
static TX_BUF: StaticCell<[u8; 256]> = StaticCell::new();
|
static TX_BUF: StaticCell<[u8; 256]> = StaticCell::new();
|
||||||
static RX_BUF: StaticCell<[u8; 256]> = StaticCell::new();
|
static RX_BUF: StaticCell<[u8; 256]> = StaticCell::new();
|
||||||
let uart = BufferedUart::new(
|
let uart = BufferedUart::new(
|
||||||
@@ -79,14 +79,19 @@ async fn main(spawner: Spawner) {
|
|||||||
// EDN OF SOFTWARE UART
|
// EDN OF SOFTWARE UART
|
||||||
|
|
||||||
let mut last_yield = Instant::now();
|
let mut last_yield = Instant::now();
|
||||||
|
let mut buf = [0u8; 32];
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
info!("tick start");
|
info!("tick start");
|
||||||
// Timer::after(Duration::from_millis(100)).await;
|
// Timer::after(Duration::from_millis(100)).await;
|
||||||
// info!("tick end");
|
// 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 {
|
if Instant::now().duration_since(last_yield) >= handle.yield_period {
|
||||||
embassy_futures::yield_now().await;
|
yield_now().await;
|
||||||
last_yield = Instant::now();
|
last_yield = Instant::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user