nuttx_embedded_hal/
macros.rs

1//! Macros for NuttX
2//! Based on https://github.com/no1wudi/nuttx.rs/blob/main/src/macros.rs
3
4/// Print a formatted message to the serial console
5#[macro_export]
6macro_rules! println {
7    //  If no parameters, print a empty string
8    () => {
9        $crate::puts_format(format_args!(""))
10    };
11    //  If 1 parameter (format string), print the format string
12    ($s:expr) => {
13        $crate::puts_format(format_args!($s))
14    };
15    //  If 2 or more parameters (format string + args), print the formatted output
16    ($s:expr, $($tt:tt)*) => {
17        $crate::puts_format(format_args!($s, $($tt)*))
18    };
19}