File tree Expand file tree Collapse file tree 2 files changed +178
-214
lines changed Expand file tree Collapse file tree 2 files changed +178
-214
lines changed Original file line number Diff line number Diff line change 6
6
use panic_halt as _;
7
7
8
8
use cortex_m_rt:: entry;
9
- use stm32f4xx_hal:: { prelude:: * , pwm , stm32 } ;
9
+ use stm32f4xx_hal:: { pac , prelude:: * , timer :: Timer } ;
10
10
11
11
#[ entry]
12
12
fn main ( ) -> ! {
13
- if let Some ( dp) = stm32 :: Peripherals :: take ( ) {
13
+ if let Some ( dp) = pac :: Peripherals :: take ( ) {
14
14
// Set up the system clock.
15
15
let rcc = dp. RCC . constrain ( ) ;
16
16
let clocks = rcc. cfgr . freeze ( ) ;
17
17
18
18
let gpioa = dp. GPIOA . split ( ) ;
19
19
let channels = ( gpioa. pa8 . into_alternate ( ) , gpioa. pa9 . into_alternate ( ) ) ;
20
20
21
- let pwm = pwm :: tim1 ( dp. TIM1 , channels , clocks, 20u32 . khz ( ) ) ;
21
+ let pwm = Timer :: tim1 ( dp. TIM1 , & clocks) . pwm ( channels , 20u32 . khz ( ) ) ;
22
22
let ( mut ch1, _ch2) = pwm;
23
23
let max_duty = ch1. get_max_duty ( ) ;
24
24
ch1. set_duty ( max_duty / 2 ) ;
You can’t perform that action at this time.
0 commit comments