Initial STM32F1 family support with two examples for STM32F103C8 (Blue Pill)

This commit is contained in:
Mariusz Ryndzionek
2021-09-26 17:08:22 +02:00
parent 1650983e46
commit bce909ec1e
14 changed files with 573 additions and 20 deletions

View File

@ -0,0 +1,29 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#[path = "../example_common.rs"]
mod example_common;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::Peripherals;
use embedded_hal::digital::v2::OutputPin;
use example_common::*;
#[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) {
info!("Hello World!");
let mut led = Output::new(p.PC13, Level::High, Speed::Low);
loop {
info!("high");
unwrap!(led.set_high());
Timer::after(Duration::from_millis(300)).await;
info!("low");
unwrap!(led.set_low());
Timer::after(Duration::from_millis(300)).await;
}
}

View File

@ -0,0 +1,27 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use defmt::info;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
use embassy_stm32::time::Hertz;
use embassy_stm32::Config;
use embassy_stm32::Peripherals;
#[path = "../example_common.rs"]
mod example_common;
fn config() -> Config {
let mut config = Config::default();
config.rcc.sys_ck = Some(Hertz(36_000_000));
config
}
#[embassy::main(config = "config()")]
async fn main(_spawner: Spawner, _p: Peripherals) -> ! {
loop {
info!("Hello World!");
Timer::after(Duration::from_secs(1)).await;
}
}