2020-12-30 00:56:32 +01:00
|
|
|
#![no_std]
|
|
|
|
#![no_main]
|
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
|
|
|
|
#[path = "../example_common.rs"]
|
|
|
|
mod example_common;
|
|
|
|
use example_common::*;
|
|
|
|
|
|
|
|
use core::task::Poll;
|
2021-03-29 03:00:48 +02:00
|
|
|
use embassy::executor::Spawner;
|
2020-12-30 00:56:32 +01:00
|
|
|
use embassy::time::{Duration, Instant, Timer};
|
2021-08-03 22:08:13 +02:00
|
|
|
use embassy_nrf::Peripherals;
|
2020-12-30 00:56:32 +01:00
|
|
|
|
2021-03-29 03:00:48 +02:00
|
|
|
#[embassy::task]
|
2020-12-30 00:56:32 +01:00
|
|
|
async fn run1() {
|
|
|
|
loop {
|
|
|
|
info!("DING DONG");
|
|
|
|
Timer::after(Duration::from_ticks(16000)).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-29 03:00:48 +02:00
|
|
|
#[embassy::task]
|
2020-12-30 00:56:32 +01:00
|
|
|
async fn run2() {
|
|
|
|
loop {
|
|
|
|
Timer::at(Instant::from_ticks(0)).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-29 03:00:48 +02:00
|
|
|
#[embassy::task]
|
2020-12-30 00:56:32 +01:00
|
|
|
async fn run3() {
|
|
|
|
futures::future::poll_fn(|cx| {
|
|
|
|
cx.waker().wake_by_ref();
|
|
|
|
Poll::<()>::Pending
|
|
|
|
})
|
|
|
|
.await;
|
|
|
|
}
|
|
|
|
|
2021-03-29 02:47:10 +02:00
|
|
|
#[embassy::main]
|
2021-05-17 11:48:58 +02:00
|
|
|
async fn main(spawner: Spawner, _p: Peripherals) {
|
2021-03-29 02:47:10 +02:00
|
|
|
unwrap!(spawner.spawn(run1()));
|
|
|
|
unwrap!(spawner.spawn(run2()));
|
|
|
|
unwrap!(spawner.spawn(run3()));
|
2020-12-30 00:56:32 +01:00
|
|
|
}
|