cortex_m_log/printer/
mod.rs1use core::fmt;
4use core::fmt::Write;
5use crate::modes::{InterruptModer};
6
7pub trait Printer {
9 type W: fmt::Write;
11 type M: InterruptModer;
13
14 fn destination(&mut self) -> &mut Self::W;
19
20 #[inline]
21 fn print(&mut self, args: fmt::Arguments) {
23 let _ = Self::M::critical_section(|_| self.destination().write_fmt(args));
24 }
25
26 #[inline]
27 fn println(&mut self, args: fmt::Arguments) {
29 let _ = Self::M::critical_section(|_| {
30 let _ = self.destination().write_fmt(args);
31 self.destination().write_str("\n")
32 });
33 }
34}
35
36pub mod generic;
37pub use generic::GenericPrinter;
38
39pub mod dummy;
40pub use self::dummy::Dummy;
41
42#[cfg(feature = "itm")]
43pub mod itm;
44#[cfg(feature = "itm")]
45pub use self::itm::Itm;
46
47#[cfg(feature = "semihosting")]
48pub mod semihosting;
49#[cfg(feature = "semihosting")]
50pub use self::semihosting::{Semihosting};