Fix embassy::main macros for std target

This commit is contained in:
Ulf Lilleengen
2021-09-02 14:45:20 +02:00
parent a3beb1ca3d
commit 5f04d6e6c5
3 changed files with 6 additions and 13 deletions

View File

@ -1,9 +1,8 @@
#![feature(type_alias_impl_trait)]
#![allow(incomplete_features)]
use embassy::executor::Executor;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy::util::Forever;
use log::*;
#[embassy::task]
@ -14,16 +13,12 @@ async fn run() {
}
}
static EXECUTOR: Forever<Executor> = Forever::new();
fn main() {
#[embassy::main]
async fn main(spawner: Spawner) {
env_logger::builder()
.filter_level(log::LevelFilter::Debug)
.format_timestamp_nanos()
.init();
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {
spawner.spawn(run()).unwrap();
});
spawner.spawn(run()).unwrap();
}