mirror of
https://github.com/iceHtwoO/novaOS.git
synced 2026-04-17 04:32:27 +00:00
Reduce clutter by using print macros with fmt
This commit is contained in:
@@ -5,10 +5,8 @@ use core::{
|
||||
|
||||
use crate::{
|
||||
mmio_read, mmio_write,
|
||||
peripherals::{
|
||||
gpio::{blink_gpio, SpecificGpio},
|
||||
uart::print,
|
||||
},
|
||||
peripherals::gpio::{blink_gpio, SpecificGpio},
|
||||
print,
|
||||
timer::sleep_s,
|
||||
};
|
||||
|
||||
@@ -45,7 +43,7 @@ unsafe extern "C" fn irq_handler() {
|
||||
#[no_mangle]
|
||||
unsafe extern "C" fn synchronous_interrupt() {
|
||||
loop {
|
||||
print("Sync Exception \r\n");
|
||||
println!("Sync Exception");
|
||||
blink_gpio(SpecificGpio::OnboardLed as u8, 100);
|
||||
esr_uart_dump();
|
||||
sleep_s(200);
|
||||
@@ -62,28 +60,28 @@ fn esr_uart_dump() {
|
||||
}
|
||||
for i in (0..32).rev() {
|
||||
if ((esr >> i) & 1) == 0 {
|
||||
print("0");
|
||||
print!("0");
|
||||
} else {
|
||||
print("1");
|
||||
print!("1");
|
||||
}
|
||||
if i % 4 == 0 && i > 0 {
|
||||
print("_");
|
||||
print!("_");
|
||||
}
|
||||
|
||||
if i == 26 || i == 25 || i == 0 {
|
||||
print("\n\r");
|
||||
print!("\n\r");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_gpio_interrupt() {
|
||||
print("Interrupt\r\n");
|
||||
println!("Interrupt");
|
||||
for i in 0..=53u32 {
|
||||
let val = read_gpio_event_detect_status(i);
|
||||
|
||||
if val {
|
||||
match i {
|
||||
26 => print("Button Pressed"),
|
||||
26 => print!("Button Pressed"),
|
||||
_ => {}
|
||||
}
|
||||
// Reset GPIO Interrupt handler by writing a 1
|
||||
|
||||
Reference in New Issue
Block a user