aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f1
diff options
context:
space:
mode:
author1-rafael-1 <[email protected]>2025-09-15 20:07:18 +0200
committer1-rafael-1 <[email protected]>2025-09-15 20:07:18 +0200
commit6bb3d2c0720fa082f27d3cdb70f516058497ec87 (patch)
tree5a1e255cff999b00800f203b91a759c720c973e5 /examples/stm32f1
parenteb685574601d98c44faed9a3534d056199b46e20 (diff)
parent92a6fd2946f2cbb15359290f68aa360953da2ff7 (diff)
Merge branch 'main' into rp2040-rtc-alarm
Diffstat (limited to 'examples/stm32f1')
-rw-r--r--examples/stm32f1/Cargo.toml24
-rw-r--r--examples/stm32f1/src/bin/input_capture.rs9
-rw-r--r--examples/stm32f1/src/bin/pwm_input.rs6
3 files changed, 23 insertions, 16 deletions
diff --git a/examples/stm32f1/Cargo.toml b/examples/stm32f1/Cargo.toml
index fe800bc80..dcb58796b 100644
--- a/examples/stm32f1/Cargo.toml
+++ b/examples/stm32f1/Cargo.toml
@@ -3,23 +3,24 @@ edition = "2021"
3name = "embassy-stm32f1-examples" 3name = "embassy-stm32f1-examples"
4version = "0.1.0" 4version = "0.1.0"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6publish = false
6 7
7[dependencies] 8[dependencies]
8# Change stm32f103c8 to your chip name, if necessary. 9# Change stm32f103c8 to your chip name, if necessary.
9embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any" ] } 10embassy-stm32 = { version = "0.4.0", path = "../../embassy-stm32", features = [ "defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any" ] }
10embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } 11embassy-sync = { version = "0.7.2", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } 12embassy-executor = { version = "0.9.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] }
12embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 13embassy-time = { version = "0.5.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt"] } 14embassy-usb = { version = "0.5.1", path = "../../embassy-usb", features = ["defmt"] }
14embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 15embassy-futures = { version = "0.1.2", path = "../../embassy-futures" }
15 16
16defmt = "0.3" 17defmt = "1.0.1"
17defmt-rtt = "0.4" 18defmt-rtt = "1.0.0"
18 19
19cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 20cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
20cortex-m-rt = "0.7.0" 21cortex-m-rt = "0.7.0"
21embedded-hal = "0.2.6" 22embedded-hal = "0.2.6"
22panic-probe = { version = "0.3", features = ["print-defmt"] } 23panic-probe = { version = "1.0.0", features = ["print-defmt"] }
23heapless = { version = "0.8", default-features = false } 24heapless = { version = "0.8", default-features = false }
24nb = "1.0.0" 25nb = "1.0.0"
25static_cell = "2.0.0" 26static_cell = "2.0.0"
@@ -29,3 +30,8 @@ opt-level = "s"
29 30
30[profile.release] 31[profile.release]
31debug = 2 32debug = 2
33
34[package.metadata.embassy]
35build = [
36 { target = "thumbv7m-none-eabi", artifact-dir = "out/examples/stm32f1" }
37]
diff --git a/examples/stm32f1/src/bin/input_capture.rs b/examples/stm32f1/src/bin/input_capture.rs
index 6fe8e0b50..b5b26938d 100644
--- a/examples/stm32f1/src/bin/input_capture.rs
+++ b/examples/stm32f1/src/bin/input_capture.rs
@@ -3,7 +3,7 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::gpio::{Level, Output, Pull, Speed}; 6use embassy_stm32::gpio::{AfioRemap, Level, Output, Pull, Speed};
7use embassy_stm32::time::khz; 7use embassy_stm32::time::khz;
8use embassy_stm32::timer::input_capture::{CapturePin, InputCapture}; 8use embassy_stm32::timer::input_capture::{CapturePin, InputCapture};
9use embassy_stm32::timer::{self, Channel}; 9use embassy_stm32::timer::{self, Channel};
@@ -37,10 +37,11 @@ async fn main(spawner: Spawner) {
37 let p = embassy_stm32::init(Default::default()); 37 let p = embassy_stm32::init(Default::default());
38 info!("Hello World!"); 38 info!("Hello World!");
39 39
40 unwrap!(spawner.spawn(blinky(p.PC13))); 40 spawner.spawn(unwrap!(blinky(p.PC13)));
41 41
42 let ch3 = CapturePin::new_ch3(p.PA2, Pull::None); 42 let ch3 = CapturePin::new(p.PA2, Pull::None);
43 let mut ic = InputCapture::new(p.TIM2, None, None, Some(ch3), None, Irqs, khz(1000), Default::default()); 43 let mut ic =
44 InputCapture::new::<AfioRemap<0>>(p.TIM2, None, None, Some(ch3), None, Irqs, khz(1000), Default::default());
44 45
45 loop { 46 loop {
46 info!("wait for rising edge"); 47 info!("wait for rising edge");
diff --git a/examples/stm32f1/src/bin/pwm_input.rs b/examples/stm32f1/src/bin/pwm_input.rs
index afbef3edb..9ae747018 100644
--- a/examples/stm32f1/src/bin/pwm_input.rs
+++ b/examples/stm32f1/src/bin/pwm_input.rs
@@ -3,7 +3,7 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::gpio::{Level, Output, Pull, Speed}; 6use embassy_stm32::gpio::{AfioRemap, Level, Output, Pull, Speed};
7use embassy_stm32::time::khz; 7use embassy_stm32::time::khz;
8use embassy_stm32::timer::pwm_input::PwmInput; 8use embassy_stm32::timer::pwm_input::PwmInput;
9use embassy_stm32::{bind_interrupts, peripherals, timer, Peri}; 9use embassy_stm32::{bind_interrupts, peripherals, timer, Peri};
@@ -36,9 +36,9 @@ async fn main(spawner: Spawner) {
36 let p = embassy_stm32::init(Default::default()); 36 let p = embassy_stm32::init(Default::default());
37 info!("Hello World!"); 37 info!("Hello World!");
38 38
39 unwrap!(spawner.spawn(blinky(p.PC13))); 39 spawner.spawn(unwrap!(blinky(p.PC13)));
40 40
41 let mut pwm_input = PwmInput::new(p.TIM2, p.PA0, Pull::None, khz(10)); 41 let mut pwm_input = PwmInput::new_ch1::<AfioRemap<0>>(p.TIM2, p.PA0, Pull::None, khz(10));
42 pwm_input.enable(); 42 pwm_input.enable();
43 43
44 loop { 44 loop {