From 6d79c4c81187d5f2704e2d2f72a3deba05ca449a Mon Sep 17 00:00:00 2001 From: Roy Date: Wed, 2 Jul 2025 15:24:01 +0300 Subject: feat: added log-to-defmt feature Signed-off-by: Roy --- embassy-nxp/Cargo.toml | 4 ++++ embassy-nxp/src/lib.rs | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'embassy-nxp') diff --git a/embassy-nxp/Cargo.toml b/embassy-nxp/Cargo.toml index 01f57c4e2..9eb48be17 100644 --- a/embassy-nxp/Cargo.toml +++ b/embassy-nxp/Cargo.toml @@ -10,6 +10,8 @@ critical-section = "1.1.2" embassy-hal-internal = { version = "0.3.0", path = "../embassy-hal-internal", features = ["cortex-m", "prio-bits-2"] } embassy-sync = { version = "0.7.0", path = "../embassy-sync" } defmt = { version = "1", optional = true } +log = "0.4.27" +log-to-defmt = { version = "0.1.0", optional = true} ## Chip dependencies lpc55-pac = { version = "0.5.0", optional = true } @@ -30,3 +32,5 @@ unstable-pac = [] #! ### Chip selection features lpc55 = ["lpc55-pac"] +## Enable debug logs +log-to-defmt = ["dep:log-to-defmt"] diff --git a/embassy-nxp/src/lib.rs b/embassy-nxp/src/lib.rs index 433aca9e0..79c66e7f6 100644 --- a/embassy-nxp/src/lib.rs +++ b/embassy-nxp/src/lib.rs @@ -3,7 +3,6 @@ pub mod gpio; #[cfg(feature = "lpc55")] pub mod pint; - // This mod MUST go last, so that it sees all the `impl_foo!` macros #[cfg_attr(feature = "lpc55", path = "chips/lpc55.rs")] mod chip; @@ -25,8 +24,10 @@ pub fn init(_config: config::Config) -> Peripherals { { gpio::init(); pint::init(); + #[cfg(feature = "log-to-defmt")] + log_to_defmt::setup(); + log::info!("Initialization complete"); } - crate::Peripherals::take() } -- cgit