Skip to content

Commit 3b4bdf4

Browse files
Bump stm32f4xx-hal in /examples/stm32f4-single-motor-example
Bumps [stm32f4xx-hal](https://github.com/stm32-rs/stm32f4xx-hal) from 0.15.0 to 0.16.0. - [Release notes](https://github.com/stm32-rs/stm32f4xx-hal/releases) - [Changelog](https://github.com/stm32-rs/stm32f4xx-hal/blob/master/CHANGELOG.md) - [Commits](stm32-rs/stm32f4xx-hal@v0.15.0...v0.16.0) --- updated-dependencies: - dependency-name: stm32f4xx-hal dependency-type: direct:production update-type: version-update:semver-minor ... note: this needed some manual work due to a breaking change in the API definition for PWM pins. Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Ralph Ursprung <[email protected]>
1 parent 007d11a commit 3b4bdf4

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

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

Lines changed: 10 additions & 4 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.15.0", features = ["stm32f401", "rtic", "rtic-monotonic"] }
12+
stm32f4xx-hal = { version = "0.16.0", features = ["stm32f401", "rtic", "rtic-monotonic"] }
1313

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

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ 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::PwmChannel;
17-
use stm32f4xx_hal::{
18-
pac, pac::TIM2, prelude::*, timer::MonoTimerUs, watchdog::IndependentWatchdog,
19-
};
16+
use stm32f4xx_hal::timer::{Channel3, MonoTimerUs, PwmChannel};
17+
use stm32f4xx_hal::{pac, pac::TIM2, prelude::*, watchdog::IndependentWatchdog};
2018
use tb6612fng::{DriveCommand, Motor};
2119

2220
#[monotonic(binds = TIM5, default = true)]
@@ -51,7 +49,7 @@ mod app {
5149
let motor_pwm = ctx
5250
.device
5351
.TIM2
54-
.pwm_hz(gpiob.pb10.into_alternate(), 100.kHz(), &clocks)
52+
.pwm_hz(Channel3::new(gpiob.pb10), 100.kHz(), &clocks)
5553
.split();
5654
let mut motor = Motor::new(motor_in1, motor_in2, motor_pwm);
5755
motor.drive_backwards(0).expect("");
@@ -84,15 +82,15 @@ mod app {
8482
}
8583

8684
/// Feed the watchdog to avoid hardware reset.
87-
#[task(priority=1, local=[watchdog])]
85+
#[task(priority = 1, local = [watchdog])]
8886
fn periodic(ctx: periodic::Context) {
8987
defmt::trace!("feeding the watchdog!");
9088
ctx.local.watchdog.feed();
9189
periodic::spawn_after(100.millis()).ok();
9290
}
9391

9492
/// Increase/decrease the motor speed every 100ms by 1% (iterates from 100% forward to 100% backwards)
95-
#[task(priority=1, local=[motor_ramp_direction], shared=[motor])]
93+
#[task(priority = 1, local = [motor_ramp_direction], shared = [motor])]
9694
fn update_motor_speed(mut ctx: update_motor_speed::Context) {
9795
ctx.shared.motor.lock(|motor| {
9896
let motor_ramp_direction = ctx.local.motor_ramp_direction;

0 commit comments

Comments
 (0)