examples Remove the fn config()
idiom.
It was only useful for doing #[embassy_executor::main(config = "config()")]`. Now that it's gone, it makes more sense to build the config in main directly.
This commit is contained in:
parent
fc6e1e06b3
commit
2e85eaf7d5
@ -9,15 +9,12 @@ use embassy_stm32::time::Hertz;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(Hertz(36_000_000));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) -> ! {
|
async fn main(_spawner: Spawner) -> ! {
|
||||||
let _p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(Hertz(36_000_000));
|
||||||
|
let _p = embassy_stm32::init(config);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
Timer::after(Duration::from_secs(1)).await;
|
Timer::after(Duration::from_secs(1)).await;
|
||||||
|
@ -15,17 +15,14 @@ use embassy_usb_serial::{CdcAcmClass, State};
|
|||||||
use futures::future::join;
|
use futures::future::join;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.hse = Some(Hertz(8_000_000));
|
config.rcc.hse = Some(Hertz(8_000_000));
|
||||||
config.rcc.sys_ck = Some(Hertz(48_000_000));
|
config.rcc.sys_ck = Some(Hertz(48_000_000));
|
||||||
config.rcc.pclk1 = Some(Hertz(24_000_000));
|
config.rcc.pclk1 = Some(Hertz(24_000_000));
|
||||||
config
|
let mut p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let mut p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -14,8 +14,10 @@ use embassy_stm32::time::Hertz;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
// Example config for maximum performance on a NUCLEO-F207ZG board
|
#[embassy_executor::main]
|
||||||
fn config() -> Config {
|
async fn main(_spawner: Spawner) {
|
||||||
|
// Example config for maximum performance on a NUCLEO-F207ZG board
|
||||||
|
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
// By default, HSE on the board comes from a 8 MHz clock signal (not a crystal)
|
// By default, HSE on the board comes from a 8 MHz clock signal (not a crystal)
|
||||||
config.rcc.hse = Some(HSEConfig {
|
config.rcc.hse = Some(HSEConfig {
|
||||||
@ -40,12 +42,9 @@ fn config() -> Config {
|
|||||||
config.rcc.apb1_pre = APBPrescaler::Div4;
|
config.rcc.apb1_pre = APBPrescaler::Div4;
|
||||||
// 120 MHz / 2 = 60 MHz APB2 frequency
|
// 120 MHz / 2 = 60 MHz APB2 frequency
|
||||||
config.rcc.apb2_pre = APBPrescaler::Div2;
|
config.rcc.apb2_pre = APBPrescaler::Div2;
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
let _p = embassy_stm32::init(config);
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let _p = embassy_stm32::init(config());
|
|
||||||
loop {
|
loop {
|
||||||
Timer::after(Duration::from_millis(1000)).await;
|
Timer::after(Duration::from_millis(1000)).await;
|
||||||
info!("1s elapsed");
|
info!("1s elapsed");
|
||||||
|
@ -9,16 +9,13 @@ use embassy_stm32::time::Hertz;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) -> ! {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.hse = Some(Hertz(8_000_000));
|
config.rcc.hse = Some(Hertz(8_000_000));
|
||||||
config.rcc.sysclk = Some(Hertz(16_000_000));
|
config.rcc.sysclk = Some(Hertz(16_000_000));
|
||||||
config
|
let _p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) -> ! {
|
|
||||||
let _p = embassy_stm32::init(config());
|
|
||||||
loop {
|
loop {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
Timer::after(Duration::from_secs(1)).await;
|
Timer::after(Duration::from_secs(1)).await;
|
||||||
|
@ -15,21 +15,16 @@ use embassy_usb_serial::{CdcAcmClass, State};
|
|||||||
use futures::future::join;
|
use futures::future::join;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
|
|
||||||
config.rcc.hse = Some(mhz(8));
|
config.rcc.hse = Some(mhz(8));
|
||||||
config.rcc.sysclk = Some(mhz(48));
|
config.rcc.sysclk = Some(mhz(48));
|
||||||
config.rcc.pclk1 = Some(mhz(24));
|
config.rcc.pclk1 = Some(mhz(24));
|
||||||
config.rcc.pclk2 = Some(mhz(24));
|
config.rcc.pclk2 = Some(mhz(24));
|
||||||
config.rcc.pll48 = true;
|
config.rcc.pll48 = true;
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
// Needed for nucleo-stm32f303ze
|
// Needed for nucleo-stm32f303ze
|
||||||
|
@ -9,15 +9,12 @@ use embassy_stm32::time::Hertz;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(Hertz(84_000_000));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) -> ! {
|
async fn main(_spawner: Spawner) -> ! {
|
||||||
let _p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(Hertz(84_000_000));
|
||||||
|
let _p = embassy_stm32::init(config);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
Timer::after(Duration::from_secs(1)).await;
|
Timer::after(Duration::from_secs(1)).await;
|
||||||
|
@ -9,15 +9,11 @@ use embassy_stm32::time::mhz;
|
|||||||
use embassy_stm32::{interrupt, Config};
|
use embassy_stm32::{interrupt, Config};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(mhz(48));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) -> ! {
|
async fn main(_spawner: Spawner) -> ! {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(mhz(48));
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let irq = interrupt::take!(SDIO);
|
let irq = interrupt::take!(SDIO);
|
||||||
|
@ -33,15 +33,12 @@ async fn net_task(stack: &'static Stack<Device>) -> ! {
|
|||||||
stack.run().await
|
stack.run().await
|
||||||
}
|
}
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(mhz(200));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(spawner: Spawner) -> ! {
|
async fn main(spawner: Spawner) -> ! {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(mhz(200));
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
// Generate random seed.
|
// Generate random seed.
|
||||||
|
@ -9,15 +9,12 @@ use embassy_stm32::time::Hertz;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(Hertz(84_000_000));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) -> ! {
|
async fn main(_spawner: Spawner) -> ! {
|
||||||
let _p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(Hertz(84_000_000));
|
||||||
|
let _p = embassy_stm32::init(config);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
Timer::after(Duration::from_secs(1)).await;
|
Timer::after(Duration::from_secs(1)).await;
|
||||||
|
@ -9,15 +9,12 @@ use embassy_stm32::time::mhz;
|
|||||||
use embassy_stm32::{interrupt, Config};
|
use embassy_stm32::{interrupt, Config};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(mhz(200));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) -> ! {
|
async fn main(_spawner: Spawner) -> ! {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(mhz(200));
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let irq = interrupt::take!(SDMMC1);
|
let irq = interrupt::take!(SDMMC1);
|
||||||
|
@ -11,18 +11,15 @@ use embassy_stm32::time::mhz;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
pub fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
config.rcc.hclk = Some(mhz(200));
|
config.rcc.hclk = Some(mhz(200));
|
||||||
config.rcc.per_ck = Some(mhz(64));
|
config.rcc.per_ck = Some(mhz(64));
|
||||||
config.rcc.adc_clock_source = AdcClockSource::PerCk;
|
config.rcc.adc_clock_source = AdcClockSource::PerCk;
|
||||||
config
|
let mut p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let mut p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let mut adc = Adc::new(p.ADC3, &mut Delay);
|
let mut adc = Adc::new(p.ADC3, &mut Delay);
|
||||||
|
@ -10,22 +10,8 @@ use embassy_stm32::i2c::I2c;
|
|||||||
use embassy_stm32::rcc::{Mco, Mco1Source, McoClock};
|
use embassy_stm32::rcc::{Mco, Mco1Source, McoClock};
|
||||||
use embassy_stm32::time::{khz, mhz};
|
use embassy_stm32::time::{khz, mhz};
|
||||||
use embassy_stm32::{interrupt, Config};
|
use embassy_stm32::{interrupt, Config};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
|
||||||
|
|
||||||
#[allow(unused)]
|
|
||||||
pub fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
|
||||||
config.rcc.hclk = Some(mhz(400));
|
|
||||||
config.rcc.pll1.q_ck = Some(mhz(100));
|
|
||||||
config.rcc.pclk1 = Some(mhz(100));
|
|
||||||
config.rcc.pclk2 = Some(mhz(100));
|
|
||||||
config.rcc.pclk3 = Some(mhz(100));
|
|
||||||
config.rcc.pclk4 = Some(mhz(100));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
use ov7725::*;
|
use ov7725::*;
|
||||||
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
const WIDTH: usize = 100;
|
const WIDTH: usize = 100;
|
||||||
const HEIGHT: usize = 100;
|
const HEIGHT: usize = 100;
|
||||||
@ -34,7 +20,16 @@ static mut FRAME: [u32; WIDTH * HEIGHT / 2] = [0u32; WIDTH * HEIGHT / 2];
|
|||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
|
config.rcc.hclk = Some(mhz(400));
|
||||||
|
config.rcc.pll1.q_ck = Some(mhz(100));
|
||||||
|
config.rcc.pclk1 = Some(mhz(100));
|
||||||
|
config.rcc.pclk2 = Some(mhz(100));
|
||||||
|
config.rcc.pclk3 = Some(mhz(100));
|
||||||
|
config.rcc.pclk4 = Some(mhz(100));
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
defmt::info!("Hello World!");
|
defmt::info!("Hello World!");
|
||||||
let mco = Mco::new(p.MCO1, p.PA8, Mco1Source::Hsi, McoClock::Divided(3));
|
let mco = Mco::new(p.MCO1, p.PA8, Mco1Source::Hsi, McoClock::Divided(3));
|
||||||
|
|
||||||
|
@ -9,19 +9,15 @@ use embassy_stm32::time::mhz;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
pub fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
|
||||||
config.rcc.hclk = Some(mhz(200));
|
|
||||||
config.rcc.pll1.q_ck = Some(mhz(100));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World, dude!");
|
info!("Hello World, dude!");
|
||||||
|
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
|
config.rcc.hclk = Some(mhz(200));
|
||||||
|
config.rcc.pll1.q_ck = Some(mhz(100));
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
let mut dac = Dac::new_1ch(p.DAC1, p.PA4);
|
let mut dac = Dac::new_1ch(p.DAC1, p.PA4);
|
||||||
|
|
||||||
|
@ -33,17 +33,13 @@ async fn net_task(stack: &'static Stack<Device>) -> ! {
|
|||||||
stack.run().await
|
stack.run().await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(spawner: Spawner) -> ! {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
config.rcc.hclk = Some(mhz(200));
|
config.rcc.hclk = Some(mhz(200));
|
||||||
config.rcc.pll1.q_ck = Some(mhz(100));
|
config.rcc.pll1.q_ck = Some(mhz(100));
|
||||||
config
|
let p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(spawner: Spawner) -> ! {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
// Generate random seed.
|
// Generate random seed.
|
||||||
|
@ -34,17 +34,13 @@ async fn net_task(stack: &'static Stack<Device>) -> ! {
|
|||||||
stack.run().await
|
stack.run().await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(spawner: Spawner) -> ! {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
config.rcc.hclk = Some(mhz(200));
|
config.rcc.hclk = Some(mhz(200));
|
||||||
config.rcc.pll1.q_ck = Some(mhz(100));
|
config.rcc.pll1.q_ck = Some(mhz(100));
|
||||||
config
|
let p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(spawner: Spawner) -> ! {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
// Generate random seed.
|
// Generate random seed.
|
||||||
|
@ -10,17 +10,14 @@ use embassy_stm32::time::mhz;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
pub fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
config.rcc.hclk = Some(mhz(200));
|
config.rcc.hclk = Some(mhz(200));
|
||||||
config.rcc.pll1.q_ck = Some(mhz(100));
|
config.rcc.pll1.q_ck = Some(mhz(100));
|
||||||
config
|
let p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let mut core_peri = cortex_m::Peripherals::take().unwrap();
|
let mut core_peri = cortex_m::Peripherals::take().unwrap();
|
||||||
|
@ -12,7 +12,8 @@ use embassy_stm32::time::{khz, mhz, Hertz};
|
|||||||
use embassy_stm32::{into_ref, Config, Peripheral, PeripheralRef};
|
use embassy_stm32::{into_ref, Config, Peripheral, PeripheralRef};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
pub fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
config.rcc.hclk = Some(mhz(400));
|
config.rcc.hclk = Some(mhz(400));
|
||||||
@ -21,12 +22,8 @@ pub fn config() -> Config {
|
|||||||
config.rcc.pclk2 = Some(mhz(100));
|
config.rcc.pclk2 = Some(mhz(100));
|
||||||
config.rcc.pclk3 = Some(mhz(100));
|
config.rcc.pclk3 = Some(mhz(100));
|
||||||
config.rcc.pclk4 = Some(mhz(100));
|
config.rcc.pclk4 = Some(mhz(100));
|
||||||
config
|
let p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let mut pwm = SimplePwm32::new(p.TIM5, p.PA0, p.PA1, p.PA2, p.PA3, khz(10));
|
let mut pwm = SimplePwm32::new(p.TIM5, p.PA0, p.PA1, p.PA2, p.PA3, khz(10));
|
||||||
|
@ -11,7 +11,8 @@ use embassy_stm32::time::{khz, mhz};
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
pub fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
config.rcc.hclk = Some(mhz(400));
|
config.rcc.hclk = Some(mhz(400));
|
||||||
@ -20,12 +21,7 @@ pub fn config() -> Config {
|
|||||||
config.rcc.pclk2 = Some(mhz(100));
|
config.rcc.pclk2 = Some(mhz(100));
|
||||||
config.rcc.pclk3 = Some(mhz(100));
|
config.rcc.pclk3 = Some(mhz(100));
|
||||||
config.rcc.pclk4 = Some(mhz(100));
|
config.rcc.pclk4 = Some(mhz(100));
|
||||||
config
|
let p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let ch1 = PwmPin::new_ch1(p.PA6);
|
let ch1 = PwmPin::new_ch1(p.PA6);
|
||||||
|
@ -9,15 +9,11 @@ use embassy_stm32::time::mhz;
|
|||||||
use embassy_stm32::{interrupt, Config};
|
use embassy_stm32::{interrupt, Config};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(mhz(200));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) -> ! {
|
async fn main(_spawner: Spawner) -> ! {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(mhz(200));
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let irq = interrupt::take!(SDMMC1);
|
let irq = interrupt::take!(SDMMC1);
|
||||||
|
@ -16,14 +16,6 @@ use embassy_util::Forever;
|
|||||||
use heapless::String;
|
use heapless::String;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
pub fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
|
||||||
config.rcc.hclk = Some(mhz(200));
|
|
||||||
config.rcc.pll1.q_ck = Some(mhz(100));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) {
|
async fn main_task(mut spi: spi::Spi<'static, SPI3, NoDma, NoDma>) {
|
||||||
for n in 0u32.. {
|
for n in 0u32.. {
|
||||||
@ -45,7 +37,11 @@ static EXECUTOR: Forever<Executor> = Forever::new();
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
|
config.rcc.hclk = Some(mhz(200));
|
||||||
|
config.rcc.pll1.q_ck = Some(mhz(100));
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
let spi = spi::Spi::new(
|
let spi = spi::Spi::new(
|
||||||
p.SPI3,
|
p.SPI3,
|
||||||
|
@ -15,14 +15,6 @@ use embassy_util::Forever;
|
|||||||
use heapless::String;
|
use heapless::String;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
pub fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.sys_ck = Some(mhz(400));
|
|
||||||
config.rcc.hclk = Some(mhz(200));
|
|
||||||
config.rcc.pll1.q_ck = Some(mhz(100));
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) {
|
async fn main_task(mut spi: spi::Spi<'static, SPI3, DMA1_CH3, DMA1_CH4>) {
|
||||||
for n in 0u32.. {
|
for n in 0u32.. {
|
||||||
@ -41,7 +33,11 @@ static EXECUTOR: Forever<Executor> = Forever::new();
|
|||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(mhz(400));
|
||||||
|
config.rcc.hclk = Some(mhz(200));
|
||||||
|
config.rcc.pll1.q_ck = Some(mhz(100));
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
let spi = spi::Spi::new(
|
let spi = spi::Spi::new(
|
||||||
p.SPI3,
|
p.SPI3,
|
||||||
|
@ -6,17 +6,15 @@ use defmt::*;
|
|||||||
use embassy_executor::executor::Spawner;
|
use embassy_executor::executor::Spawner;
|
||||||
use embassy_stm32::exti::ExtiInput;
|
use embassy_stm32::exti::ExtiInput;
|
||||||
use embassy_stm32::gpio::{Input, Pull};
|
use embassy_stm32::gpio::{Input, Pull};
|
||||||
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> embassy_stm32::Config {
|
|
||||||
let mut config = embassy_stm32::Config::default();
|
|
||||||
config.rcc.enable_hsi48 = true;
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.enable_hsi48 = true;
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
let button = Input::new(p.PB2, Pull::Up);
|
let button = Input::new(p.PB2, Pull::Up);
|
||||||
let mut button = ExtiInput::new(button, p.EXTI2);
|
let mut button = ExtiInput::new(button, p.EXTI2);
|
||||||
|
|
||||||
|
@ -18,16 +18,13 @@ use lorawan::default_crypto::DefaultFactory as Crypto;
|
|||||||
use lorawan_device::async_device::{region, Device, JoinMode};
|
use lorawan_device::async_device::{region, Device, JoinMode};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> embassy_stm32::Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = embassy_stm32::Config::default();
|
let mut config = embassy_stm32::Config::default();
|
||||||
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSI16;
|
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSI16;
|
||||||
config.rcc.enable_hsi48 = true;
|
config.rcc.enable_hsi48 = true;
|
||||||
config
|
let p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
// SPI for sx127x
|
// SPI for sx127x
|
||||||
let spi = spi::Spi::new(
|
let spi = spi::Spi::new(
|
||||||
p.SPI1,
|
p.SPI1,
|
||||||
|
@ -9,7 +9,8 @@ use embassy_stm32::rng::Rng;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
// 72Mhz clock (16 / 1 * 18 / 4)
|
// 72Mhz clock (16 / 1 * 18 / 4)
|
||||||
config.rcc.mux = ClockSrc::PLL(
|
config.rcc.mux = ClockSrc::PLL(
|
||||||
@ -19,12 +20,8 @@ fn config() -> Config {
|
|||||||
PLLMul::Mul18,
|
PLLMul::Mul18,
|
||||||
Some(PLLClkDiv::Div6), // 48Mhz (16 / 1 * 18 / 6)
|
Some(PLLClkDiv::Div6), // 48Mhz (16 / 1 * 18 / 6)
|
||||||
);
|
);
|
||||||
config
|
let p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let mut rng = Rng::new(p.RNG);
|
let mut rng = Rng::new(p.RNG);
|
||||||
|
@ -9,7 +9,8 @@ use embassy_stm32::rng::Rng;
|
|||||||
use embassy_stm32::Config;
|
use embassy_stm32::Config;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.mux = ClockSrc::PLL(
|
config.rcc.mux = ClockSrc::PLL(
|
||||||
PLLSource::HSI16,
|
PLLSource::HSI16,
|
||||||
@ -18,12 +19,8 @@ fn config() -> Config {
|
|||||||
PLLMul::Mul8,
|
PLLMul::Mul8,
|
||||||
Some(PLLClkDiv::Div2),
|
Some(PLLClkDiv::Div2),
|
||||||
);
|
);
|
||||||
config
|
let p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let mut rng = Rng::new(p.RNG);
|
let mut rng = Rng::new(p.RNG);
|
||||||
|
@ -83,19 +83,13 @@ async fn net_task(stack: &'static Stack<Device>) -> ! {
|
|||||||
stack.run().await
|
stack.run().await
|
||||||
}
|
}
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.mux = ClockSrc::HSE(Hertz(16_000_000));
|
|
||||||
|
|
||||||
config.rcc.mux = ClockSrc::PLL(PLLSource::HSI16, PLLClkDiv::Div2, PLLSrcDiv::Div1, PLLMul::Mul10, None);
|
|
||||||
config.rcc.hsi48 = true;
|
|
||||||
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(spawner: Spawner) {
|
async fn main(spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.mux = ClockSrc::PLL(PLLSource::HSI16, PLLClkDiv::Div2, PLLSrcDiv::Div1, PLLMul::Mul10, None);
|
||||||
|
config.rcc.hsi48 = true;
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
// Create the driver, from the HAL.
|
// Create the driver, from the HAL.
|
||||||
let irq = interrupt::take!(USB_FS);
|
let irq = interrupt::take!(USB_FS);
|
||||||
let driver = Driver::new(p.USB, irq, p.PA12, p.PA11);
|
let driver = Driver::new(p.USB, irq, p.PA12, p.PA11);
|
||||||
|
@ -17,19 +17,13 @@ use futures::future::join;
|
|||||||
use usbd_hid::descriptor::{MouseReport, SerializedDescriptor};
|
use usbd_hid::descriptor::{MouseReport, SerializedDescriptor};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.mux = ClockSrc::HSE(Hertz(16_000_000));
|
|
||||||
|
|
||||||
config.rcc.mux = ClockSrc::PLL(PLLSource::HSI16, PLLClkDiv::Div2, PLLSrcDiv::Div1, PLLMul::Mul10, None);
|
|
||||||
config.rcc.hsi48 = true;
|
|
||||||
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.mux = ClockSrc::PLL(PLLSource::HSI16, PLLClkDiv::Div2, PLLSrcDiv::Div1, PLLMul::Mul10, None);
|
||||||
|
config.rcc.hsi48 = true;
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
// Create the driver, from the HAL.
|
// Create the driver, from the HAL.
|
||||||
let irq = interrupt::take!(USB_FS);
|
let irq = interrupt::take!(USB_FS);
|
||||||
let driver = Driver::new(p.USB, irq, p.PA12, p.PA11);
|
let driver = Driver::new(p.USB, irq, p.PA12, p.PA11);
|
||||||
|
@ -14,19 +14,13 @@ use embassy_usb_serial::{CdcAcmClass, State};
|
|||||||
use futures::future::join;
|
use futures::future::join;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> Config {
|
|
||||||
let mut config = Config::default();
|
|
||||||
config.rcc.mux = ClockSrc::HSE(Hertz(16_000_000));
|
|
||||||
|
|
||||||
config.rcc.mux = ClockSrc::PLL(PLLSource::HSI16, PLLClkDiv::Div2, PLLSrcDiv::Div1, PLLMul::Mul10, None);
|
|
||||||
config.rcc.hsi48 = true;
|
|
||||||
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = Config::default();
|
||||||
|
config.rcc.mux = ClockSrc::PLL(PLLSource::HSI16, PLLClkDiv::Div2, PLLSrcDiv::Div1, PLLMul::Mul10, None);
|
||||||
|
config.rcc.hsi48 = true;
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
// Create the driver, from the HAL.
|
// Create the driver, from the HAL.
|
||||||
|
@ -17,16 +17,13 @@ use lorawan::default_crypto::DefaultFactory as Crypto;
|
|||||||
use lorawan_device::async_device::{region, Device, JoinMode};
|
use lorawan_device::async_device::{region, Device, JoinMode};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
fn config() -> embassy_stm32::Config {
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = embassy_stm32::Config::default();
|
let mut config = embassy_stm32::Config::default();
|
||||||
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSI16;
|
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSI16;
|
||||||
config.rcc.enable_lsi = true;
|
config.rcc.enable_lsi = true;
|
||||||
config
|
let p = embassy_stm32::init(config);
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
|
||||||
async fn main(_spawner: Spawner) {
|
|
||||||
let p = embassy_stm32::init(config());
|
|
||||||
unsafe { pac::RCC.ccipr().modify(|w| w.set_rngsel(0b01)) }
|
unsafe { pac::RCC.ccipr().modify(|w| w.set_rngsel(0b01)) }
|
||||||
|
|
||||||
let ctrl1 = Output::new(p.PC3.degrade(), Level::High, Speed::High);
|
let ctrl1 = Output::new(p.PC3.degrade(), Level::High, Speed::High);
|
||||||
|
@ -52,15 +52,12 @@ const TCXO_MODE: TcxoMode = TcxoMode::new()
|
|||||||
|
|
||||||
const TX_PARAMS: TxParams = TxParams::new().set_power(0x0D).set_ramp_time(RampTime::Micros40);
|
const TX_PARAMS: TxParams = TxParams::new().set_power(0x0D).set_ramp_time(RampTime::Micros40);
|
||||||
|
|
||||||
fn config() -> embassy_stm32::Config {
|
|
||||||
let mut config = embassy_stm32::Config::default();
|
|
||||||
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE32;
|
|
||||||
config
|
|
||||||
}
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_stm32::init(config());
|
let mut config = embassy_stm32::Config::default();
|
||||||
|
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE32;
|
||||||
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
let mut led1 = Output::new(p.PB15, Level::High, Speed::Low);
|
let mut led1 = Output::new(p.PB15, Level::High, Speed::Low);
|
||||||
let mut led2 = Output::new(p.PB9, Level::Low, Speed::Low);
|
let mut led2 = Output::new(p.PB9, Level::Low, Speed::Low);
|
||||||
let mut led3 = Output::new(p.PB11, Level::Low, Speed::Low);
|
let mut led3 = Output::new(p.PB11, Level::Low, Speed::Low);
|
||||||
|
Loading…
Reference in New Issue
Block a user