Skip to content

Commit 1193b21

Browse files
authored
Merge pull request #53 from richardeoin/pwm-inverted-pins
Support PWM output on inverted CHx pins
2 parents 14a5d19 + 1d8bacd commit 1193b21

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/timer/pins.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ timer_pins!(TIM1, [
3939
(Channel4, PA11<DefaultMode>, AltFunction::AF2),
4040
(Channel4, PC11<DefaultMode>, AltFunction::AF2),
4141
]);
42+
// Inverted pins
43+
timer_pins!(TIM1, [
44+
(Channel1, PA7<DefaultMode>, AltFunction::AF2),
45+
(Channel1, PB13<DefaultMode>, AltFunction::AF2),
46+
(Channel1, PD2<DefaultMode>, AltFunction::AF2),
47+
(Channel2, PB0<DefaultMode>, AltFunction::AF2),
48+
(Channel2, PB14<DefaultMode>, AltFunction::AF2),
49+
(Channel2, PD3<DefaultMode>, AltFunction::AF2),
50+
(Channel3, PB1<DefaultMode>, AltFunction::AF2),
51+
(Channel3, PB15<DefaultMode>, AltFunction::AF2),
52+
(Channel3, PD4<DefaultMode>, AltFunction::AF2),
53+
]);
4254

4355
#[cfg(feature = "stm32g0x1")]
4456
timer_pins!(TIM2, [
@@ -83,16 +95,34 @@ timer_pins!(TIM15, [
8395
(Channel1, PA2<DefaultMode>, AltFunction::AF5),
8496
(Channel1, PB14<DefaultMode>, AltFunction::AF5),
8597
(Channel1, PC1<DefaultMode>, AltFunction::AF2),
98+
(Channel2, PA3<DefaultMode>, AltFunction::AF5),
99+
(Channel2, PB15<DefaultMode>, AltFunction::AF5),
100+
(Channel2, PC2<DefaultMode>, AltFunction::AF2),
101+
]);
102+
// Inverted pins
103+
#[cfg(any(feature = "stm32g070", feature = "stm32g071", feature = "stm32g081"))]
104+
timer_pins!(TIM15, [
105+
(Channel1, PA1<DefaultMode>, AltFunction::AF5),
106+
(Channel1, PB13<DefaultMode>, AltFunction::AF5),
107+
(Channel1, PF1<DefaultMode>, AltFunction::AF2),
86108
]);
87109

88110
timer_pins!(TIM16, [
89111
(Channel1, PA6<DefaultMode>, AltFunction::AF5),
90112
(Channel1, PB8<DefaultMode>, AltFunction::AF2),
91113
(Channel1, PD0<DefaultMode>, AltFunction::AF2),
92114
]);
115+
// Inverted pins
116+
timer_pins!(TIM16, [
117+
(Channel1, PB6<DefaultMode>, AltFunction::AF2),
118+
]);
93119

94120
timer_pins!(TIM17, [
95121
(Channel1, PA7<DefaultMode>, AltFunction::AF6),
96122
(Channel1, PB9<DefaultMode>, AltFunction::AF2),
97123
(Channel1, PD1<DefaultMode>, AltFunction::AF2),
98124
]);
125+
// Inverted pins
126+
timer_pins!(TIM17, [
127+
(Channel1, PB7<DefaultMode>, AltFunction::AF2),
128+
]);

0 commit comments

Comments
 (0)