`stm32` PWM complementary pin
I have been trying to use the SimplePwm type of the embassy-stm32 crate, and while mostly successful, I have been trying to use complementary channels for a negated signal of the PWM signal.
While looking at the source code and the existing examples, I could not find a way to use complementary channels. (There do seem to be traits related to them tho, e.g., Channel3ComplementaryPin)
How would I enable complementary pins? Any help would be very much appreciated!
Thank you very much for creating such a fantastic library!
Hey, this anwser might be a bit late, but you need to create a complementary pin first, like this
let pc5 = ComplementaryPwmPin::new_ch4(p.PC5, OutputType::PushPull);
Then create the pwm like this
let pwm1 = ComplementaryPwm::new(
p.TIM1,
Some(pa8),
None,
Some(pa9),
None,
None,
None,
None,
Some(pc5),
hz(50),
CountingMode::EdgeAlignedUp,
);
where you always supply CH1, CH1N, CH2, CH2N,... (pa8 is ch1 in this example and pa9 ch2, with pc5 being ch4n)