@@ -18,7 +18,7 @@ use hal::gpio::GpioExt;
18
18
use hal:: pac;
19
19
use hal:: pwm:: { tim16, tim2, tim3, tim8} ;
20
20
use hal:: rcc:: RccExt ;
21
- use hal:: time:: U32Ext ;
21
+ use hal:: time:: rate :: * ;
22
22
23
23
#[ entry]
24
24
fn main ( ) -> ! {
@@ -28,7 +28,7 @@ fn main() -> ! {
28
28
// Configure our clocks
29
29
let mut flash = dp. FLASH . constrain ( ) ;
30
30
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 ) ;
32
32
33
33
// Prep the pins we need in their correct alternate function
34
34
let mut gpioa = dp. GPIOA . split ( & mut rcc. ahb ) ;
@@ -52,9 +52,9 @@ fn main() -> ! {
52
52
// A four channel general purpose timer that's broadly available
53
53
let tim3_channels = tim3 (
54
54
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
58
58
) ;
59
59
60
60
// Channels without pins cannot be enabled, so we can't forget to
@@ -101,9 +101,9 @@ fn main() -> ! {
101
101
// A 32-bit timer, so we can set a larger resolution
102
102
let tim2_channels = tim2 (
103
103
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
107
107
) ;
108
108
109
109
let mut tim2_ch3 = tim2_channels. 2 . output_to_pb10 ( pb10) ;
@@ -116,9 +116,9 @@ fn main() -> ! {
116
116
// just use it directly
117
117
let mut tim16_ch1 = tim16 (
118
118
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
122
122
)
123
123
. output_to_pb8 ( pb8) ;
124
124
tim16_ch1. set_duty ( tim16_ch1. get_max_duty ( ) / 20 ) ; // 5% duty cyle
@@ -130,9 +130,9 @@ fn main() -> ! {
130
130
// to complementary pins (works just like standard pins)
131
131
let tim8_channels = tim8 (
132
132
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
136
136
) ;
137
137
138
138
let mut tim8_ch1 = tim8_channels. 0 . output_to_pc10 ( pc10) ;
0 commit comments