rustfmt example

This commit is contained in:
Lucas Martins 2024-10-30 17:15:37 -03:00
parent af2aedb588
commit d6b67abefa
No known key found for this signature in database
GPG Key ID: 6333B378837ABABA

View File

@ -1,14 +1,13 @@
#![no_std]
#![no_main]
use {defmt_rtt as _, panic_probe as _};
use embassy_time::Timer;
use defmt::{debug, error, info};
use embassy_executor::Spawner;
use embassy_stm32::{bind_interrupts, peripherals, usart::{self, Uart}};
use defmt::{debug, info, error};
use embassy_stm32::usart::{self, Uart};
use embassy_stm32::{bind_interrupts, peripherals};
use embassy_time::Timer;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
/*--- Main ---------------------------------------------------------------------------------------*/
@ -51,18 +50,12 @@ async fn main(_spawner: Spawner) {
let mut count = 0;
loop {
if let Ok(c) = port_rx.read(&mut read_buff)
.await
.map_err(|e| {
if let Ok(c) = port_rx.read(&mut read_buff).await.map_err(|e| {
error!("read error: {}", e);
})
{
if let Ok(s) = core::str::from_utf8(&read_buff)
.map_err(|e| {
}) {
if let Ok(s) = core::str::from_utf8(&read_buff).map_err(|e| {
error!("str parse error: {}", defmt::Debug2Format(&e));
})
{
}) {
count += c;
debug!("total_rx: {} delta: {} -- rx: {}", count, c, s);