@@ -59,50 +59,50 @@ fn main() -> ! {
59
59
//// Operations affecting all defined channels on the Timer
60
60
61
61
// Adjust period to 0.5 seconds
62
- pwm. set_period ( 500 . ms ( ) ) ;
62
+ pwm. try_set_period ( 500 . ms ( ) ) . unwrap ( ) ;
63
63
64
64
asm:: bkpt ( ) ;
65
65
66
66
// Return to the original frequency
67
- pwm. set_period ( 1 . khz ( ) ) ;
67
+ pwm. try_set_period ( 1 . khz ( ) ) . unwrap ( ) ;
68
68
69
69
asm:: bkpt ( ) ;
70
70
71
- let max = pwm. get_max_duty ( ) ;
71
+ let max = pwm. try_get_max_duty ( ) . unwrap ( ) ;
72
72
73
73
//// Operations affecting single channels can be accessed through
74
74
//// the Pwm object or via dereferencing to the pin.
75
75
76
76
// Use the Pwm object to set C3 to full strength
77
- pwm. set_duty ( Channel :: C3 , max) ;
77
+ pwm. try_set_duty ( Channel :: C3 , max) . unwrap ( ) ;
78
78
79
79
asm:: bkpt ( ) ;
80
80
81
81
// Use the Pwm object to set C3 to be dim
82
- pwm. set_duty ( Channel :: C3 , max / 4 ) ;
82
+ pwm. try_set_duty ( Channel :: C3 , max / 4 ) . unwrap ( ) ;
83
83
84
84
asm:: bkpt ( ) ;
85
85
86
86
// Use the Pwm object to set C3 to be zero
87
- pwm. set_duty ( Channel :: C3 , 0 ) ;
87
+ pwm. try_set_duty ( Channel :: C3 , 0 ) . unwrap ( ) ;
88
88
89
89
asm:: bkpt ( ) ;
90
90
91
91
// Extract the PwmChannel for C3
92
92
let mut pwm_channel = pwm. split ( ) . 2 ;
93
93
94
94
// Use the PwmChannel object to set C3 to be full strength
95
- pwm_channel. set_duty ( max) ;
95
+ pwm_channel. try_set_duty ( max) . unwrap ( ) ;
96
96
97
97
asm:: bkpt ( ) ;
98
98
99
99
// Use the PwmChannel object to set C3 to be dim
100
- pwm_channel. set_duty ( max / 4 ) ;
100
+ pwm_channel. try_set_duty ( max / 4 ) . unwrap ( ) ;
101
101
102
102
asm:: bkpt ( ) ;
103
103
104
104
// Use the PwmChannel object to set C3 to be zero
105
- pwm_channel. set_duty ( 0 ) ;
105
+ pwm_channel. try_set_duty ( 0 ) . unwrap ( ) ;
106
106
107
107
asm:: bkpt ( ) ;
108
108
0 commit comments