Added timer set polarity functions for main and complementary outputs individually

This commit is contained in:
r.marple 2025-09-03 15:53:50 +10:00
parent 2ef9dfb512
commit 089b6722c6
2 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- fix: Fixed STM32H5 builds requiring time feature
- feat: Derive Clone, Copy for QSPI Config
- fix: stm32/i2c in master mode (blocking): subsequent transmissions failed after a NACK was received
- feat: stm32/timer: add set_polarity functions for main and complementary outputs in complementary_pwm
## 0.4.0 - 2025-08-26

View File

@ -185,6 +185,16 @@ impl<'d, T: AdvancedInstance4Channel> ComplementaryPwm<'d, T> {
self.inner.set_complementary_output_polarity(channel, polarity);
}
/// Set the main output polarity for a given channel.
pub fn set_main_polarity(&mut self, channel: Channel, polarity: OutputPolarity) {
self.inner.set_output_polarity(channel, polarity);
}
/// Set the complementary output polarity for a given channel.
pub fn set_complementary_polarity(&mut self, channel: Channel, polarity: OutputPolarity) {
self.inner.set_complementary_output_polarity(channel, polarity);
}
/// Set the dead time as a proportion of max_duty
pub fn set_dead_time(&mut self, value: u16) {
let (ckd, value) = compute_dead_time_value(value);