Allow rtos_trace example to be used without log
This commit is contained in:
parent
c1d8c8cf36
commit
cd561b19ef
2 changed files with 10 additions and 4 deletions
|
@ -35,7 +35,6 @@ log = [
|
|||
rtos-trace = [
|
||||
"dep:rtos-trace",
|
||||
"dep:systemview-target",
|
||||
"log",
|
||||
"embassy-executor/rtos-trace",
|
||||
"embassy-executor/rtos-trace-interrupt",
|
||||
]
|
||||
|
@ -68,7 +67,7 @@ log = { version = "0.4.17", optional = true }
|
|||
|
||||
[[bin]]
|
||||
name = "rtos_trace"
|
||||
required-features = ["nightly", "rtos-trace", "log"]
|
||||
required-features = ["nightly", "rtos-trace"]
|
||||
|
||||
[patch.crates-io]
|
||||
rtos-trace = { git = "https://gitlab.com/quentinmit/rtos-trace.git", branch = "build-fix" }
|
||||
|
|
|
@ -13,6 +13,7 @@ use embassy_nrf::Peripherals;
|
|||
use rtos_trace;
|
||||
use systemview_target::SystemView;
|
||||
use panic_probe as _;
|
||||
#[cfg(feature = "log")]
|
||||
use log::*;
|
||||
|
||||
static LOGGER: systemview_target::SystemView = systemview_target::SystemView::new();
|
||||
|
@ -31,7 +32,10 @@ rtos_trace::global_application_callbacks!{TraceInfo}
|
|||
#[embassy_executor::task]
|
||||
async fn run1() {
|
||||
loop {
|
||||
#[cfg(feature = "log")]
|
||||
info!("DING DONG");
|
||||
#[cfg(not(feature = "log"))]
|
||||
rtos_trace::trace::marker(13);
|
||||
Timer::after(Duration::from_ticks(16000)).await;
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +59,11 @@ async fn run3() {
|
|||
#[embassy_executor::main]
|
||||
async fn main(spawner: Spawner, _p: Peripherals) {
|
||||
LOGGER.init();
|
||||
#[cfg(feature = "log")]
|
||||
{
|
||||
::log::set_logger(&LOGGER).ok();
|
||||
::log::set_max_level(::log::LevelFilter::Trace);
|
||||
}
|
||||
|
||||
spawner.spawn(run1()).unwrap();
|
||||
spawner.spawn(run2()).unwrap();
|
||||
|
|
Loading…
Reference in a new issue