From d399e207e5e69ac0ef92a729c8941a50f087f006 Mon Sep 17 00:00:00 2001 From: Ralph Ursprung Date: Tue, 8 Oct 2024 10:47:51 +0200 Subject: [PATCH 1/2] update `Cargo.lock` of example --- .../stm32f4-single-motor-example/Cargo.lock | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/stm32f4-single-motor-example/Cargo.lock b/examples/stm32f4-single-motor-example/Cargo.lock index a114dfd..b839c9e 100644 --- a/examples/stm32f4-single-motor-example/Cargo.lock +++ b/examples/stm32f4-single-motor-example/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bare-metal" @@ -137,7 +137,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -235,7 +235,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -380,9 +380,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -553,9 +553,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -575,29 +575,29 @@ dependencies = [ [[package]] name = "tb6612fng" -version = "0.2.0" +version = "1.0.0" dependencies = [ "embedded-hal 1.0.0", ] [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -620,9 +620,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "vcell" From 7a3ac36c0b4d64274d7fb2221cba37315cbdb8da Mon Sep 17 00:00:00 2001 From: Ralph Ursprung Date: Tue, 8 Oct 2024 11:19:53 +0200 Subject: [PATCH 2/2] example: update to `stm32f4xx-hal` to 0.22.0 this is a breaking change and thus needs some manual changes. see stm32-rs/stm32f4xx-hal#791 for details. --- .../stm32f4-single-motor-example/Cargo.lock | 46 ++++++++++++------- .../stm32f4-single-motor-example/Cargo.toml | 2 +- .../stm32f4-single-motor-example/src/main.rs | 9 ++-- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/examples/stm32f4-single-motor-example/Cargo.lock b/examples/stm32f4-single-motor-example/Cargo.lock index b839c9e..f5eff6e 100644 --- a/examples/stm32f4-single-motor-example/Cargo.lock +++ b/examples/stm32f4-single-motor-example/Cargo.lock @@ -212,6 +212,12 @@ dependencies = [ "nb 1.1.0", ] +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "embedded-storage" version = "0.3.1" @@ -348,6 +354,12 @@ dependencies = [ "defmt", ] +[[package]] +name = "portable-atomic" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" + [[package]] name = "powerfmt" version = "0.2.0" @@ -486,18 +498,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "stm32f4" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb94729242cd1aebe6dab42a2ca0131985ae93bc3ab2751b680df724bb35528d" -dependencies = [ - "bare-metal 1.0.0", - "cortex-m", - "cortex-m-rt", - "vcell", -] - [[package]] name = "stm32f4-single-motor-example" version = "0.1.0" @@ -511,11 +511,25 @@ dependencies = [ "tb6612fng", ] +[[package]] +name = "stm32f4-staging" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a6d5e873d8f15406aadd4349b491e28617173a90f152c0635863b1919070af" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "critical-section", + "defmt", + "portable-atomic", + "vcell", +] + [[package]] name = "stm32f4xx-hal" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed60591531f4da636d828701c74861a3d100e5c4e36677cadbd2eb6f46eb67" +checksum = "243ab58411b5b063098402d18a5d44916336ec86a288b613796e376bd83eaf80" dependencies = [ "bare-metal 1.0.0", "cortex-m", @@ -526,6 +540,7 @@ dependencies = [ "embedded-hal 0.2.7", "embedded-hal 1.0.0", "embedded-hal-nb", + "embedded-io", "embedded-storage", "enumflags2", "fugit", @@ -533,10 +548,9 @@ dependencies = [ "nb 1.1.0", "rand_core", "rtic-monotonic", - "stm32f4", + "stm32f4-staging", "systick-monotonic", "time", - "vcell", "void", ] diff --git a/examples/stm32f4-single-motor-example/Cargo.toml b/examples/stm32f4-single-motor-example/Cargo.toml index a5ab71c..39a4860 100644 --- a/examples/stm32f4-single-motor-example/Cargo.toml +++ b/examples/stm32f4-single-motor-example/Cargo.toml @@ -9,7 +9,7 @@ cortex-m = { version = "0.7", features = ["critical-section-single-core"]} cortex-m-rtic = "1.1.4" panic-probe = { version = "0.3", features = ["print-defmt"] } -stm32f4xx-hal = { version = "0.21.0", features = ["stm32f401", "rtic1"] } +stm32f4xx-hal = { version = "0.22", features = ["stm32f401", "rtic1"] } defmt = "0.3.6" defmt-rtt = "0.4" diff --git a/examples/stm32f4-single-motor-example/src/main.rs b/examples/stm32f4-single-motor-example/src/main.rs index cf65476..5997b8b 100644 --- a/examples/stm32f4-single-motor-example/src/main.rs +++ b/examples/stm32f4-single-motor-example/src/main.rs @@ -13,7 +13,7 @@ use defmt_rtt as _; #[rtic::app(device = stm32f4xx_hal::pac, dispatchers = [EXTI1])] mod app { use stm32f4xx_hal::gpio::{Edge, Input, Output, PB4, PB5, PC13}; - use stm32f4xx_hal::timer::{Channel3, MonoTimerUs, PwmChannel}; + use stm32f4xx_hal::timer::{MonoTimerUs, PwmChannel}; use stm32f4xx_hal::{pac, pac::TIM2, prelude::*, watchdog::IndependentWatchdog}; use tb6612fng::{DriveCommand, Motor}; @@ -46,11 +46,8 @@ mod app { // set up the motor let motor_in1 = gpiob.pb5.into_push_pull_output(); let motor_in2 = gpiob.pb4.into_push_pull_output(); - let mut motor_pwm = ctx - .device - .TIM2 - .pwm_hz(Channel3::new(gpiob.pb10), 100.kHz(), &clocks) - .split(); + let (_, (_, _, motor_pwm, ..)) = ctx.device.TIM2.pwm_hz(100.kHz(), &clocks); + let mut motor_pwm = motor_pwm.with(gpiob.pb10); motor_pwm.enable(); let mut motor = Motor::new(motor_in1, motor_in2, motor_pwm).unwrap(); motor.drive(DriveCommand::Backward(0)).unwrap();