2020-12-30 00:56:32 +01:00
|
|
|
#![no_std]
|
|
|
|
#![no_main]
|
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
|
2022-09-22 16:42:49 +02:00
|
|
|
use core::future::poll_fn;
|
2020-12-30 00:56:32 +01:00
|
|
|
use core::task::Poll;
|
2022-06-12 22:15:44 +02:00
|
|
|
|
2022-04-02 04:35:06 +02:00
|
|
|
use defmt::{info, unwrap};
|
2022-08-17 23:40:16 +02:00
|
|
|
use embassy_executor::Spawner;
|
2023-10-15 01:57:25 +02:00
|
|
|
use embassy_time::{Instant, Timer};
|
2022-06-12 22:15:44 +02:00
|
|
|
use {defmt_rtt as _, panic_probe as _};
|
2022-04-02 04:35:06 +02:00
|
|
|
|
2022-07-29 21:58:35 +02:00
|
|
|
#[embassy_executor::task]
|
2020-12-30 00:56:32 +01:00
|
|
|
async fn run1() {
|
|
|
|
loop {
|
|
|
|
info!("DING DONG");
|
2023-10-15 01:57:25 +02:00
|
|
|
Timer::after_ticks(16000).await;
|
2020-12-30 00:56:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-29 21:58:35 +02:00
|
|
|
#[embassy_executor::task]
|
2020-12-30 00:56:32 +01:00
|
|
|
async fn run2() {
|
|
|
|
loop {
|
|
|
|
Timer::at(Instant::from_ticks(0)).await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-29 21:58:35 +02:00
|
|
|
#[embassy_executor::task]
|
2020-12-30 00:56:32 +01:00
|
|
|
async fn run3() {
|
2022-09-22 16:42:49 +02:00
|
|
|
poll_fn(|cx| {
|
2020-12-30 00:56:32 +01:00
|
|
|
cx.waker().wake_by_ref();
|
|
|
|
Poll::<()>::Pending
|
|
|
|
})
|
|
|
|
.await;
|
|
|
|
}
|
|
|
|
|
2022-07-29 21:58:35 +02:00
|
|
|
#[embassy_executor::main]
|
2022-08-17 18:49:55 +02:00
|
|
|
async fn main(spawner: Spawner) {
|
|
|
|
let _p = embassy_nrf::init(Default::default());
|
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
|
|
|
}
|