Skip to content

Commit 493e96f

Browse files
committed
pwm
1 parent b0205b7 commit 493e96f

File tree

2 files changed

+178
-214
lines changed

2 files changed

+178
-214
lines changed

examples/pwm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
use panic_halt as _;
77

88
use cortex_m_rt::entry;
9-
use stm32f4xx_hal::{prelude::*, pwm, stm32};
9+
use stm32f4xx_hal::{pac, prelude::*, timer::Timer};
1010

1111
#[entry]
1212
fn main() -> ! {
13-
if let Some(dp) = stm32::Peripherals::take() {
13+
if let Some(dp) = pac::Peripherals::take() {
1414
// Set up the system clock.
1515
let rcc = dp.RCC.constrain();
1616
let clocks = rcc.cfgr.freeze();
1717

1818
let gpioa = dp.GPIOA.split();
1919
let channels = (gpioa.pa8.into_alternate(), gpioa.pa9.into_alternate());
2020

21-
let pwm = pwm::tim1(dp.TIM1, channels, clocks, 20u32.khz());
21+
let pwm = Timer::tim1(dp.TIM1, &clocks).pwm(channels, 20u32.khz());
2222
let (mut ch1, _ch2) = pwm;
2323
let max_duty = ch1.get_max_duty();
2424
ch1.set_duty(max_duty / 2);

0 commit comments

Comments
 (0)