From 2edf532f8d8ce048137990bf74b07759428ed7c1 Mon Sep 17 00:00:00 2001 From: Quentin Smith Date: Thu, 18 Aug 2022 01:38:58 -0400 Subject: Move rtos-trace example to a separate project to simplify Cargo.toml --- examples/nrf/src/bin/rtos_trace.rs | 69 -------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 examples/nrf/src/bin/rtos_trace.rs (limited to 'examples/nrf/src') diff --git a/examples/nrf/src/bin/rtos_trace.rs b/examples/nrf/src/bin/rtos_trace.rs deleted file mode 100644 index 5699fe8e2..000000000 --- a/examples/nrf/src/bin/rtos_trace.rs +++ /dev/null @@ -1,69 +0,0 @@ -#![no_std] -#![no_main] -#![feature(type_alias_impl_trait)] - -use core::task::Poll; - -use embassy_executor::executor::Spawner; -use embassy_executor::time::{Duration, Instant, Timer}; -use embassy_nrf::Peripherals; -#[cfg(feature = "log")] -use log::*; -use panic_probe as _; -// N.B. systemview_target cannot be used at the same time as defmt_rtt. -use rtos_trace; -use systemview_target::SystemView; - -static LOGGER: systemview_target::SystemView = systemview_target::SystemView::new(); -rtos_trace::global_trace! {SystemView} - -struct TraceInfo(); - -impl rtos_trace::RtosTraceApplicationCallbacks for TraceInfo { - fn system_description() {} - fn sysclock() -> u32 { - 64000000 - } -} -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; - } -} - -#[embassy_executor::task] -async fn run2() { - loop { - Timer::at(Instant::from_ticks(0)).await; - } -} - -#[embassy_executor::task] -async fn run3() { - futures::future::poll_fn(|cx| { - cx.waker().wake_by_ref(); - Poll::<()>::Pending - }) - .await; -} - -#[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(); - spawner.spawn(run3()).unwrap(); -} -- cgit