From 20d3dc87f95f844e747a7e93036ce9ddac369081 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Fri, 1 Jan 2021 22:41:59 +0100 Subject: Rename examples -> embassy-nrf-examples --- examples/src/bin/executor_fairness_test.rs | 74 ------------------------------ 1 file changed, 74 deletions(-) delete mode 100644 examples/src/bin/executor_fairness_test.rs (limited to 'examples/src/bin/executor_fairness_test.rs') diff --git a/examples/src/bin/executor_fairness_test.rs b/examples/src/bin/executor_fairness_test.rs deleted file mode 100644 index 9b2c1bd26..000000000 --- a/examples/src/bin/executor_fairness_test.rs +++ /dev/null @@ -1,74 +0,0 @@ -#![no_std] -#![no_main] -#![feature(type_alias_impl_trait)] - -#[path = "../example_common.rs"] -mod example_common; -use example_common::*; - -use core::task::Poll; -use cortex_m_rt::entry; -use defmt::panic; -use embassy::executor::{task, Executor}; -use embassy::time::{Duration, Instant, Timer}; -use embassy::util::Forever; -use embassy_nrf::pac; -use embassy_nrf::{interrupt, rtc}; -use nrf52840_hal::clocks; - -#[task] -async fn run1() { - loop { - info!("DING DONG"); - Timer::after(Duration::from_ticks(16000)).await; - } -} - -#[task] -async fn run2() { - loop { - Timer::at(Instant::from_ticks(0)).await; - } -} - -#[task] -async fn run3() { - futures::future::poll_fn(|cx| { - cx.waker().wake_by_ref(); - Poll::<()>::Pending - }) - .await; -} - -static RTC: Forever> = Forever::new(); -static ALARM: Forever> = Forever::new(); -static EXECUTOR: Forever = Forever::new(); - -#[entry] -fn main() -> ! { - info!("Hello World!"); - - let p = unwrap!(embassy_nrf::pac::Peripherals::take()); - - clocks::Clocks::new(p.CLOCK) - .enable_ext_hfosc() - .set_lfclk_src_external(clocks::LfOscConfiguration::NoExternalNoBypass) - .start_lfclk(); - - let rtc = RTC.put(rtc::RTC::new(p.RTC1, interrupt::take!(RTC1))); - rtc.start(); - - unsafe { embassy::time::set_clock(rtc) }; - - let alarm = ALARM.put(rtc.alarm0()); - let executor = EXECUTOR.put(Executor::new_with_alarm(alarm, cortex_m::asm::sev)); - - unwrap!(executor.spawn(run1())); - unwrap!(executor.spawn(run2())); - unwrap!(executor.spawn(run3())); - - loop { - executor.run(); - cortex_m::asm::wfe(); - } -} -- cgit