init basic examples and setup

This commit is contained in:
2026-05-25 18:16:02 +02:00
commit 8028dfd5fc
28 changed files with 2150 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
[package]
name = "embassy-blinky"
version = "0.1.0"
edition = "2024"
publish = false
build = "build.rs"
[dependencies]
cortex-m-rt.workspace = true
defmt.workspace = true
defmt-rtt.workspace = true
embassy-executor = { workspace = true, features = ["defmt", "executor-thread", "platform-cortex-m"] }
embassy-stm32 = { workspace = true, features = ["defmt", "stm32f103c8", "time-driver-tim2"] }
embassy-time.workspace = true
panic-probe.workspace = true

View File

@@ -0,0 +1,9 @@
fn main() {
println!("cargo:rerun-if-changed=../../memory.x");
println!(
"cargo:rustc-link-search={}",
std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap())
.join("../..")
.display()
);
}

View File

@@ -0,0 +1,28 @@
#![deny(unsafe_code)]
#![no_std]
#![no_main]
use defmt::info;
use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::Timer;
use panic_probe as _;
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let p = embassy_stm32::init(Default::default());
let mut led = Output::new(p.PC13, Level::High, Speed::Low);
info!("embassy-blinky: async blink on PC13");
loop {
led.set_low();
info!("led on");
Timer::after_millis(500).await;
led.set_high();
info!("led off");
Timer::after_millis(500).await;
}
}