From e75066820ad320495ca70570641c90d75247b19b Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Fri, 7 Nov 2025 10:07:33 -0800 Subject: cargo +nightly fmt Signed-off-by: Felipe Balbi --- src/uart.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/uart.rs') diff --git a/src/uart.rs b/src/uart.rs index 65dd91492..3209a318d 100644 --- a/src/uart.rs +++ b/src/uart.rs @@ -1,11 +1,13 @@ //! Minimal polling UART2 bring-up replicating MCUXpresso hello_world ordering. //! WARNING: This is a narrow implementation only for debug console (115200 8N1). -use crate::pac; use core::cell::RefCell; + use cortex_m::interrupt::Mutex; use embassy_sync::signal::Signal; +use crate::pac; + // svd2rust defines the shared LPUART RegisterBlock under lpuart0; all instances reuse it. type Regs = pac::lpuart0::RegisterBlock; @@ -108,7 +110,7 @@ impl Uart { cortex_m::asm::delay(3); // Short delay for reset to take effect l.global().write(|w| w.rst().no_effect()); cortex_m::asm::delay(10); // Allow peripheral to stabilize after reset - // 2) BAUD + // 2) BAUD let (osr, sbr) = compute_osr_sbr(cfg.src_hz, cfg.baud); l.baud().modify(|_, w| { let w = match cfg.stop_bits { @@ -234,8 +236,7 @@ impl RingBuffer { // Global RX buffer shared between interrupt handler and UART instance static RX_BUFFER: Mutex> = Mutex::new(RefCell::new(RingBuffer::new())); -static RX_SIGNAL: Signal = - Signal::new(); +static RX_SIGNAL: Signal = Signal::new(); // Debug counter for interrupt handler calls static mut INTERRUPT_COUNT: u32 = 0; @@ -279,9 +280,7 @@ impl Uart { /// Type-level handler for LPUART2 interrupts, compatible with bind_interrupts!. pub struct UartInterruptHandler; -impl crate::interrupt::typelevel::Handler - for UartInterruptHandler -{ +impl crate::interrupt::typelevel::Handler for UartInterruptHandler { unsafe fn on_interrupt() { INTERRUPT_COUNT += 1; -- cgit