Skip to content

Commit

Permalink
fix: again more useful debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
zpg6 committed Dec 30, 2024
1 parent a19f915 commit 7c830df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions examples/src/bin/uart_break_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ fn main() -> ! {

loop {
uart.wait_for_break();
esp_println::println!("Break detected!");
esp_println::print!("\nBREAK");

while let Ok(byte) = uart.read_byte() {
esp_println::print!(" {:02X}", byte);
}
}
}
}
9 changes: 8 additions & 1 deletion examples/src/bin/uart_break_detection_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ async fn main(_spawner: Spawner) {

loop {
uart.wait_for_break_async().await;
esp_println::println!("Break detected!");
esp_println::print!("\nBREAK");

let mut buf = [0u8; 1024];
while let Ok(size) = uart.read_async(&mut buf).await {
for i in 0..size {
esp_println::print!(" {:02X}", buf[i]);
}
}
}
}

0 comments on commit 7c830df

Please sign in to comment.