You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
Rust
39 lines
1.0 KiB
Rust
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
//
|
|
// Copyright (c) 2018-2021 Andre Richter <andre.o.richter@gmail.com>
|
|
|
|
//! Printing.
|
|
|
|
use crate::{bsp, console};
|
|
use core::fmt;
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
// Public Code
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
#[doc(hidden)]
|
|
pub fn _print(args: fmt::Arguments) {
|
|
use console::interface::Write;
|
|
|
|
bsp::console::console().write_fmt(args).unwrap();
|
|
}
|
|
|
|
/// Prints without a newline.
|
|
///
|
|
/// Carbon copy from <https://doc.rust-lang.org/src/std/macros.rs.html>
|
|
#[macro_export]
|
|
macro_rules! print {
|
|
($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*)));
|
|
}
|
|
|
|
/// Prints with a newline.
|
|
///
|
|
/// Carbon copy from <https://doc.rust-lang.org/src/std/macros.rs.html>
|
|
#[macro_export]
|
|
macro_rules! println {
|
|
() => ($crate::print!("\n"));
|
|
($($arg:tt)*) => ({
|
|
$crate::print::_print(format_args_nl!($($arg)*));
|
|
})
|
|
}
|