diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/nrf/Cargo.toml | 3 | ||||
| -rw-r--r-- | examples/nrf/src/bin/rtos_trace.rs | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/examples/nrf/Cargo.toml b/examples/nrf/Cargo.toml index 2f877b6a1..8704f27c3 100644 --- a/examples/nrf/Cargo.toml +++ b/examples/nrf/Cargo.toml | |||
| @@ -35,7 +35,6 @@ log = [ | |||
| 35 | rtos-trace = [ | 35 | rtos-trace = [ |
| 36 | "dep:rtos-trace", | 36 | "dep:rtos-trace", |
| 37 | "dep:systemview-target", | 37 | "dep:systemview-target", |
| 38 | "log", | ||
| 39 | "embassy-executor/rtos-trace", | 38 | "embassy-executor/rtos-trace", |
| 40 | "embassy-executor/rtos-trace-interrupt", | 39 | "embassy-executor/rtos-trace-interrupt", |
| 41 | ] | 40 | ] |
| @@ -68,7 +67,7 @@ log = { version = "0.4.17", optional = true } | |||
| 68 | 67 | ||
| 69 | [[bin]] | 68 | [[bin]] |
| 70 | name = "rtos_trace" | 69 | name = "rtos_trace" |
| 71 | required-features = ["nightly", "rtos-trace", "log"] | 70 | required-features = ["nightly", "rtos-trace"] |
| 72 | 71 | ||
| 73 | [patch.crates-io] | 72 | [patch.crates-io] |
| 74 | rtos-trace = { git = "https://gitlab.com/quentinmit/rtos-trace.git", branch = "build-fix" } | 73 | rtos-trace = { git = "https://gitlab.com/quentinmit/rtos-trace.git", branch = "build-fix" } |
diff --git a/examples/nrf/src/bin/rtos_trace.rs b/examples/nrf/src/bin/rtos_trace.rs index 8b4f5b755..461e174c9 100644 --- a/examples/nrf/src/bin/rtos_trace.rs +++ b/examples/nrf/src/bin/rtos_trace.rs | |||
| @@ -13,6 +13,7 @@ use embassy_nrf::Peripherals; | |||
| 13 | use rtos_trace; | 13 | use rtos_trace; |
| 14 | use systemview_target::SystemView; | 14 | use systemview_target::SystemView; |
| 15 | use panic_probe as _; | 15 | use panic_probe as _; |
| 16 | #[cfg(feature = "log")] | ||
| 16 | use log::*; | 17 | use log::*; |
| 17 | 18 | ||
| 18 | static LOGGER: systemview_target::SystemView = systemview_target::SystemView::new(); | 19 | static LOGGER: systemview_target::SystemView = systemview_target::SystemView::new(); |
| @@ -31,7 +32,10 @@ rtos_trace::global_application_callbacks!{TraceInfo} | |||
| 31 | #[embassy_executor::task] | 32 | #[embassy_executor::task] |
| 32 | async fn run1() { | 33 | async fn run1() { |
| 33 | loop { | 34 | loop { |
| 35 | #[cfg(feature = "log")] | ||
| 34 | info!("DING DONG"); | 36 | info!("DING DONG"); |
| 37 | #[cfg(not(feature = "log"))] | ||
| 38 | rtos_trace::trace::marker(13); | ||
| 35 | Timer::after(Duration::from_ticks(16000)).await; | 39 | Timer::after(Duration::from_ticks(16000)).await; |
| 36 | } | 40 | } |
| 37 | } | 41 | } |
| @@ -55,8 +59,11 @@ async fn run3() { | |||
| 55 | #[embassy_executor::main] | 59 | #[embassy_executor::main] |
| 56 | async fn main(spawner: Spawner, _p: Peripherals) { | 60 | async fn main(spawner: Spawner, _p: Peripherals) { |
| 57 | LOGGER.init(); | 61 | LOGGER.init(); |
| 58 | ::log::set_logger(&LOGGER).ok(); | 62 | #[cfg(feature = "log")] |
| 59 | ::log::set_max_level(::log::LevelFilter::Trace); | 63 | { |
| 64 | ::log::set_logger(&LOGGER).ok(); | ||
| 65 | ::log::set_max_level(::log::LevelFilter::Trace); | ||
| 66 | } | ||
| 60 | 67 | ||
| 61 | spawner.spawn(run1()).unwrap(); | 68 | spawner.spawn(run1()).unwrap(); |
| 62 | spawner.spawn(run2()).unwrap(); | 69 | spawner.spawn(run2()).unwrap(); |
