embassy/embassy-stm32-examples/src/bin/rtc_async.rs

40 lines
831 B
Rust
Raw Normal View History

2021-02-16 00:38:36 +00:00
#![no_std]
#![no_main]
2021-03-17 01:48:16 +00:00
#![feature(min_type_alias_impl_trait)]
#![feature(impl_trait_in_bindings)]
2021-02-16 00:38:36 +00:00
#![feature(type_alias_impl_trait)]
#[path = "../example_common.rs"]
mod example_common;
use example_common::*;
use defmt::panic;
use embassy;
use embassy::executor::Spawner;
2021-02-16 00:38:36 +00:00
use embassy::time::{Duration, Timer};
2021-03-30 15:05:52 +00:00
use embassy_stm32;
use embassy_stm32::hal;
2021-02-16 00:38:36 +00:00
#[embassy::task]
2021-02-16 00:38:36 +00:00
async fn run1() {
loop {
info!("BIG INFREQUENT TICK");
Timer::after(Duration::from_ticks(32768 * 2 as u64)).await;
2021-02-16 00:38:36 +00:00
}
}
#[embassy::task]
2021-02-16 00:38:36 +00:00
async fn run2() {
loop {
info!("tick");
Timer::after(Duration::from_ticks(13000 as u64)).await;
2021-02-16 00:38:36 +00:00
}
}
#[embassy::main(use_hse = 16)]
async fn main(spawner: Spawner) {
let (dp, clocks) = embassy_stm32::Peripherals::take().unwrap();
2021-02-16 00:38:36 +00:00
spawner.spawn(run1()).unwrap();
2021-02-16 00:38:36 +00:00
}