From 50be0413e500b31c0fcaed4cf119d8679b1a8af1 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Mon, 7 Oct 2024 21:31:08 +0900 Subject: [PATCH] Reduce vertical space slightly in UART examples --- src/bare-metal/aps/examples/src/main_improved.rs | 4 +--- src/bare-metal/aps/examples/src/pl011.rs | 5 +---- src/bare-metal/aps/examples/src/pl011_minimal.rs | 5 +---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/bare-metal/aps/examples/src/main_improved.rs b/src/bare-metal/aps/examples/src/main_improved.rs index dbff9d5398c..057a8b1bcb2 100644 --- a/src/bare-metal/aps/examples/src/main_improved.rs +++ b/src/bare-metal/aps/examples/src/main_improved.rs @@ -41,9 +41,7 @@ extern "C" fn main(x0: u64, x1: u64, x2: u64, x3: u64) { if let Some(byte) = uart.read_byte() { uart.write_byte(byte); match byte { - b'\r' => { - uart.write_byte(b'\n'); - } + b'\r' => uart.write_byte(b'\n'), b'q' => break, _ => {} } diff --git a/src/bare-metal/aps/examples/src/pl011.rs b/src/bare-metal/aps/examples/src/pl011.rs index 40b33bc3b34..65867bd6532 100644 --- a/src/bare-metal/aps/examples/src/pl011.rs +++ b/src/bare-metal/aps/examples/src/pl011.rs @@ -122,10 +122,7 @@ impl Uart { // SAFETY: We know that self.registers points to the control registers // of a PL011 device which is appropriately mapped. - unsafe { - // Write to the TX buffer. - addr_of_mut!((*self.registers).dr).write_volatile(byte.into()); - } + unsafe { addr_of_mut!((*self.registers).dr).write_volatile(byte.into()) }; // Wait until the UART is no longer busy. while self.read_flag_register().contains(Flags::BUSY) {} diff --git a/src/bare-metal/aps/examples/src/pl011_minimal.rs b/src/bare-metal/aps/examples/src/pl011_minimal.rs index 26b6f4c01c3..55c3266e187 100644 --- a/src/bare-metal/aps/examples/src/pl011_minimal.rs +++ b/src/bare-metal/aps/examples/src/pl011_minimal.rs @@ -43,10 +43,7 @@ impl Uart { // SAFETY: We know that the base address points to the control // registers of a PL011 device which is appropriately mapped. - unsafe { - // Write to the TX buffer. - self.base_address.write_volatile(byte); - } + unsafe { self.base_address.write_volatile(byte) }; // Wait until the UART is no longer busy. while self.read_flag_register() & FR_BUSY != 0 {}