Skip to content

Commit 6d371d3

Browse files
authored
Merge pull request #53 from rursprung/update-stm32f4xx-hal-0.22.0
example: update to stm32f4xx-hal to 0.22.0
2 parents 6bb24b3 + 7a3ac36 commit 6d371d3

File tree

3 files changed

+50
-39
lines changed

3 files changed

+50
-39
lines changed

examples/stm32f4-single-motor-example/Cargo.lock

Lines changed: 46 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/stm32f4-single-motor-example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cortex-m = { version = "0.7", features = ["critical-section-single-core"]}
99
cortex-m-rtic = "1.1.4"
1010
panic-probe = { version = "0.3", features = ["print-defmt"] }
1111

12-
stm32f4xx-hal = { version = "0.21.0", features = ["stm32f401", "rtic1"] }
12+
stm32f4xx-hal = { version = "0.22", features = ["stm32f401", "rtic1"] }
1313

1414
defmt = "0.3.6"
1515
defmt-rtt = "0.4"

examples/stm32f4-single-motor-example/src/main.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use defmt_rtt as _;
1313
#[rtic::app(device = stm32f4xx_hal::pac, dispatchers = [EXTI1])]
1414
mod app {
1515
use stm32f4xx_hal::gpio::{Edge, Input, Output, PB4, PB5, PC13};
16-
use stm32f4xx_hal::timer::{Channel3, MonoTimerUs, PwmChannel};
16+
use stm32f4xx_hal::timer::{MonoTimerUs, PwmChannel};
1717
use stm32f4xx_hal::{pac, pac::TIM2, prelude::*, watchdog::IndependentWatchdog};
1818
use tb6612fng::{DriveCommand, Motor};
1919

@@ -46,11 +46,8 @@ mod app {
4646
// set up the motor
4747
let motor_in1 = gpiob.pb5.into_push_pull_output();
4848
let motor_in2 = gpiob.pb4.into_push_pull_output();
49-
let mut motor_pwm = ctx
50-
.device
51-
.TIM2
52-
.pwm_hz(Channel3::new(gpiob.pb10), 100.kHz(), &clocks)
53-
.split();
49+
let (_, (_, _, motor_pwm, ..)) = ctx.device.TIM2.pwm_hz(100.kHz(), &clocks);
50+
let mut motor_pwm = motor_pwm.with(gpiob.pb10);
5451
motor_pwm.enable();
5552
let mut motor = Motor::new(motor_in1, motor_in2, motor_pwm).unwrap();
5653
motor.drive(DriveCommand::Backward(0)).unwrap();

0 commit comments

Comments
 (0)