Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example: update to stm32f4xx-hal to 0.22.0 #53

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 46 additions & 32 deletions examples/stm32f4-single-motor-example/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/stm32f4-single-motor-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 3 additions & 6 deletions examples/stm32f4-single-motor-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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();
Expand Down