This removes the need to duplicate the configuration for each individual chip, but will instead pass on the configuration specified in the config attribute. Update nrf, stm32, rp macros with passing the config to a per-chip configure function which assumes the appropriate configuration to be passed to it. To demonstrate this feature, the stm32l0xx clock setup and RTC is added which exposes clock configuration different from stm32f4xx (and has a different set of timers and HAL APIs).
41 lines
879 B
Rust
41 lines
879 B
Rust
#![no_std]
|
|
#![no_main]
|
|
#![feature(min_type_alias_impl_trait)]
|
|
#![feature(impl_trait_in_bindings)]
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
#[path = "../example_common.rs"]
|
|
mod example_common;
|
|
use example_common::*;
|
|
|
|
use defmt::panic;
|
|
use embassy;
|
|
|
|
use embassy::executor::Spawner;
|
|
use embassy::time::{Duration, Timer};
|
|
use embassy_stm32;
|
|
use embassy_stm32::hal;
|
|
|
|
#[embassy::task]
|
|
async fn run1() {
|
|
loop {
|
|
info!("BIG INFREQUENT TICK");
|
|
Timer::after(Duration::from_ticks(32768 * 2 as u64)).await;
|
|
}
|
|
}
|
|
|
|
#[embassy::task]
|
|
async fn run2() {
|
|
loop {
|
|
info!("tick");
|
|
Timer::after(Duration::from_ticks(13000 as u64)).await;
|
|
}
|
|
}
|
|
|
|
#[embassy::main(config = "embassy_stm32::system::Config::new().use_hse(16)")]
|
|
async fn main(spawner: Spawner) {
|
|
let (dp, clocks) = embassy_stm32::Peripherals::take().unwrap();
|
|
|
|
spawner.spawn(run1()).unwrap();
|
|
}
|