aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Miller <[email protected]>2024-09-06 14:08:22 -0500
committerGrant Miller <[email protected]>2024-09-06 14:08:22 -0500
commitd24c47a3ff4a82786b67f06d876bafb1bdabc163 (patch)
treed1e7d6ee7df9facf8dcff2cff5676db5984253bd
parentf571ab9d600cdb6e3f146a6b2bf464fb817065af (diff)
Missing docs
-rw-r--r--embassy-stm32/src/timer/simple_pwm.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs
index 8673bce54..47188053c 100644
--- a/embassy-stm32/src/timer/simple_pwm.rs
+++ b/embassy-stm32/src/timer/simple_pwm.rs
@@ -95,14 +95,20 @@ impl<'d, T: GeneralInstance4Channel> SimplePwmChannel<'d, T> {
95 self.timer.set_compare_value(self.channel, duty.into()) 95 self.timer.set_compare_value(self.channel, duty.into())
96 } 96 }
97 97
98 /// Set the duty cycle to 0%, or always inactive.
98 pub fn set_duty_cycle_fully_off(&mut self) { 99 pub fn set_duty_cycle_fully_off(&mut self) {
99 self.set_duty_cycle(0); 100 self.set_duty_cycle(0);
100 } 101 }
101 102
103 /// Set the duty cycle to 100%, or always active.
102 pub fn set_duty_cycle_fully_on(&mut self) { 104 pub fn set_duty_cycle_fully_on(&mut self) {
103 self.set_duty_cycle((*self).max_duty_cycle()); 105 self.set_duty_cycle((*self).max_duty_cycle());
104 } 106 }
105 107
108 /// Set the duty cycle to `num / denom`.
109 ///
110 /// The caller is responsible for ensuring that `num` is less than or equal to `denom`,
111 /// and that `denom` is not zero.
106 pub fn set_duty_cycle_fraction(&mut self, num: u16, denom: u16) { 112 pub fn set_duty_cycle_fraction(&mut self, num: u16, denom: u16) {
107 assert!(denom != 0); 113 assert!(denom != 0);
108 assert!(num <= denom); 114 assert!(num <= denom);
@@ -113,6 +119,9 @@ impl<'d, T: GeneralInstance4Channel> SimplePwmChannel<'d, T> {
113 self.set_duty_cycle(duty as u16); 119 self.set_duty_cycle(duty as u16);
114 } 120 }
115 121
122 /// Set the duty cycle to `percent / 100`
123 ///
124 /// The caller is responsible for ensuring that `percent` is less than or equal to 100.
116 pub fn set_duty_cycle_percent(&mut self, percent: u8) { 125 pub fn set_duty_cycle_percent(&mut self, percent: u8) {
117 self.set_duty_cycle_fraction(u16::from(percent), 100) 126 self.set_duty_cycle_fraction(u16::from(percent), 100)
118 } 127 }