File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 69
69
The second example selects PC8 and PC9 channels for TIM3 PWM output:
70
70
71
71
```
72
- struct MyChannels(PB5 <Alternate<PushPull>>);
72
+ struct MyChannels(PC8<Alternate<PushPull>>, PC9 <Alternate<PushPull>>);
73
73
74
74
impl Pins<TIM3> for MyChannels {
75
75
const REMAP: u8 = 0b11; // use TIM3 AFIO remapping for PC6, PC7, PC8, PC9 pins
115
115
116
116
let device: pac::Peripherals = ..;
117
117
118
- let (c1, c2) = device.TIM3.pwm(
118
+ let (mut c1, mut c2) = device.TIM3.pwm(
119
119
MyChannels(p1, p2),
120
120
&mut afio.mapr,
121
121
100.hz(),
122
122
clocks,
123
123
&mut rcc.apb1
124
124
);
125
125
126
- // Set the duty cycle of channel 0 to 50%
126
+ // Set the duty cycle of channels C1 and C2 to 50% and 25% respectively
127
127
c1.set_duty(c1.get_max_duty() / 2);
128
+ c2.set_duty(c2.get_max_duty() / 4);
129
+
128
130
// PWM outputs are disabled by default
129
131
c1.enable()
132
+ c2.enable()
130
133
131
134
```
132
135
*/
You can’t perform that action at this time.
0 commit comments