diff options
| -rw-r--r-- | embassy-rp/src/pwm.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/embassy-rp/src/pwm.rs b/embassy-rp/src/pwm.rs index ff19bcf48..15655d24e 100644 --- a/embassy-rp/src/pwm.rs +++ b/embassy-rp/src/pwm.rs | |||
| @@ -11,8 +11,8 @@ use crate::gpio::{AnyPin, Pin as GpioPin}; | |||
| 11 | use crate::{pac, peripherals, RegExt}; | 11 | use crate::{pac, peripherals, RegExt}; |
| 12 | 12 | ||
| 13 | /// The configuration of a PWM slice. | 13 | /// The configuration of a PWM slice. |
| 14 | ///Note the period in clock cycles of a slice can be computed as: | 14 | /// Note the period in clock cycles of a slice can be computed as: |
| 15 | /// (top + 1) * (phase_correct ? 1 : 2) * divider | 15 | /// `(top + 1) * (phase_correct ? 1 : 2) * divider` |
| 16 | #[non_exhaustive] | 16 | #[non_exhaustive] |
| 17 | #[derive(Clone)] | 17 | #[derive(Clone)] |
| 18 | pub struct Config { | 18 | pub struct Config { |
| @@ -26,7 +26,6 @@ pub struct Config { | |||
| 26 | /// The output frequency is halved when phase-correct mode is enabled. | 26 | /// The output frequency is halved when phase-correct mode is enabled. |
| 27 | pub phase_correct: bool, | 27 | pub phase_correct: bool, |
| 28 | /// Enables the PWM slice, allowing it to generate an output. | 28 | /// Enables the PWM slice, allowing it to generate an output. |
| 29 | /// When disabled, the PWM slice will not produce any output. | ||
| 30 | pub enable: bool, | 29 | pub enable: bool, |
| 31 | /// A fractional clock divider, represented as a fixed-point number with | 30 | /// A fractional clock divider, represented as a fixed-point number with |
| 32 | /// 8 integer bits and 4 fractional bits. It allows precise control over | 31 | /// 8 integer bits and 4 fractional bits. It allows precise control over |
| @@ -35,11 +34,11 @@ pub struct Config { | |||
| 35 | pub divider: fixed::FixedU16<fixed::types::extra::U4>, | 34 | pub divider: fixed::FixedU16<fixed::types::extra::U4>, |
| 36 | /// The output on channel A goes high when `compare_a` is higher than the | 35 | /// The output on channel A goes high when `compare_a` is higher than the |
| 37 | /// counter. A compare of 0 will produce an always low output, while a | 36 | /// counter. A compare of 0 will produce an always low output, while a |
| 38 | /// compare of `top` + 1 will produce an always high output. | 37 | /// compare of `top + 1` will produce an always high output. |
| 39 | pub compare_a: u16, | 38 | pub compare_a: u16, |
| 40 | /// The output on channel B goes high when `compare_b` is higher than the | 39 | /// The output on channel B goes high when `compare_b` is higher than the |
| 41 | /// counter. A compare of 0 will produce an always low output, while a | 40 | /// counter. A compare of 0 will produce an always low output, while a |
| 42 | /// compare of `top` + 1 will produce an always high output. | 41 | /// compare of `top + 1` will produce an always high output. |
| 43 | pub compare_b: u16, | 42 | pub compare_b: u16, |
| 44 | /// The point at which the counter wraps, representing the maximum possible | 43 | /// The point at which the counter wraps, representing the maximum possible |
| 45 | /// period. The counter will either wrap to 0 or reverse depending on the | 44 | /// period. The counter will either wrap to 0 or reverse depending on the |
| @@ -198,7 +197,7 @@ impl<'d, T: Channel> Pwm<'d, T> { | |||
| 198 | } | 197 | } |
| 199 | 198 | ||
| 200 | /// Advances a slice’s output phase by one count while it is running | 199 | /// Advances a slice’s output phase by one count while it is running |
| 201 | /// by inserting or deleting pulses from the clock enable. The counter | 200 | /// by inserting a pulse into the clock enable. The counter |
| 202 | /// will not count faster than once per cycle. | 201 | /// will not count faster than once per cycle. |
| 203 | #[inline] | 202 | #[inline] |
| 204 | pub fn phase_advance(&mut self) { | 203 | pub fn phase_advance(&mut self) { |
| @@ -208,8 +207,8 @@ impl<'d, T: Channel> Pwm<'d, T> { | |||
| 208 | } | 207 | } |
| 209 | 208 | ||
| 210 | /// Retards a slice’s output phase by one count while it is running | 209 | /// Retards a slice’s output phase by one count while it is running |
| 211 | /// by deleting pulses from the clock enable. The counter will not | 210 | /// by deleting a pulse from the clock enable. The counter will not |
| 212 | /// count backward when clock enable is permenantly low | 211 | /// count backward when clock enable is permenantly low. |
| 213 | #[inline] | 212 | #[inline] |
| 214 | pub fn phase_retard(&mut self) { | 213 | pub fn phase_retard(&mut self) { |
| 215 | let p = self.inner.regs(); | 214 | let p = self.inner.regs(); |
