main/console: console abstraction and print macros
authorKit Rhett Aultman <kit@kitaultman.com>
Sun, 30 Jun 2024 05:00:43 +0000 (01:00 -0400)
committerKit Rhett Aultman <kit@kitaultman.com>
Sun, 30 Jun 2024 05:00:43 +0000 (01:00 -0400)
commit08da45cef8b6e400e666a3177d25db8fc1ba575b
tree5a96653e6d943a41b6d1916968b94fbf4478feee
parent773fc4902041bbcffeed31459b45d58ba544b84a
main/console: console abstraction and print macros

This commit does a bit of a cleanup and re-org of the UART code so that
code doesn't need to create and carry around a reference to the UART to
print to the console.  This is now available through print!() and
println!()

As with the prior commit, this was heavily informed by Meyer Zinn's
excellent blog posts on bare-metal Rust, specifically this one:
https://meyerzinn.tech/posts/2023/03/08/p1-printing-and-allocating/

The idea here is to basically create a singleton Console object and then
only access it behind the print!() and println!() macros.  Since the
macros are designed to be used anywhere, they hide the interactions with
a global singleton which performs the debug outputs.

Even though I likely shouldn't have, I also did a rustfmt to clean up
syntax here.  Ah, well.
Cargo.lock
Cargo.toml
src/console.rs [new file with mode: 0644]
src/main.rs