@@ -18,7 +18,7 @@ use hal::gpio::GpioExt;
1818use hal:: pac;
1919use hal:: pwm:: { tim16, tim2, tim3, tim8} ;
2020use hal:: rcc:: RccExt ;
21- use hal:: time:: U32Ext ;
21+ use hal:: time:: rate :: * ;
2222
2323#[ entry]
2424fn main ( ) -> ! {
@@ -28,7 +28,7 @@ fn main() -> ! {
2828 // Configure our clocks
2929 let mut flash = dp. FLASH . constrain ( ) ;
3030 let mut rcc = dp. RCC . constrain ( ) ;
31- let clocks = rcc. cfgr . sysclk ( 16 . mhz ( ) ) . freeze ( & mut flash. acr ) ;
31+ let clocks = rcc. cfgr . sysclk ( 16u32 . MHz ( ) ) . freeze ( & mut flash. acr ) ;
3232
3333 // Prep the pins we need in their correct alternate function
3434 let mut gpioa = dp. GPIOA . split ( & mut rcc. ahb ) ;
@@ -52,9 +52,9 @@ fn main() -> ! {
5252 // A four channel general purpose timer that's broadly available
5353 let tim3_channels = tim3 (
5454 dp. TIM3 ,
55- 1280 , // resolution of duty cycle
56- 50 . hz ( ) , // frequency of period
57- & clocks, // To get the timer's clock speed
55+ 1280 , // resolution of duty cycle
56+ 50u32 . Hz ( ) , // frequency of period
57+ & clocks, // To get the timer's clock speed
5858 ) ;
5959
6060 // Channels without pins cannot be enabled, so we can't forget to
@@ -101,9 +101,9 @@ fn main() -> ! {
101101 // A 32-bit timer, so we can set a larger resolution
102102 let tim2_channels = tim2 (
103103 dp. TIM2 ,
104- 160000 , // resolution of duty cycle
105- 50 . hz ( ) , // frequency of period
106- & clocks, // To get the timer's clock speed
104+ 160000 , // resolution of duty cycle
105+ 50u32 . Hz ( ) , // frequency of period
106+ & clocks, // To get the timer's clock speed
107107 ) ;
108108
109109 let mut tim2_ch3 = tim2_channels. 2 . output_to_pb10 ( pb10) ;
@@ -116,9 +116,9 @@ fn main() -> ! {
116116 // just use it directly
117117 let mut tim16_ch1 = tim16 (
118118 dp. TIM16 ,
119- 1280 , // resolution of duty cycle
120- 50 . hz ( ) , // frequency of period
121- & clocks, // To get the timer's clock speed
119+ 1280 , // resolution of duty cycle
120+ 50u32 . Hz ( ) , // frequency of period
121+ & clocks, // To get the timer's clock speed
122122 )
123123 . output_to_pb8 ( pb8) ;
124124 tim16_ch1. set_duty ( tim16_ch1. get_max_duty ( ) / 20 ) ; // 5% duty cyle
@@ -130,9 +130,9 @@ fn main() -> ! {
130130 // to complementary pins (works just like standard pins)
131131 let tim8_channels = tim8 (
132132 dp. TIM8 ,
133- 1280 , // resolution of duty cycle
134- 50 . hz ( ) , // frequency of period
135- & clocks, // To get the timer's clock speed
133+ 1280 , // resolution of duty cycle
134+ 50u32 . Hz ( ) , // frequency of period
135+ & clocks, // To get the timer's clock speed
136136 ) ;
137137
138138 let mut tim8_ch1 = tim8_channels. 0 . output_to_pc10 ( pc10) ;
0 commit comments