diff options
| -rw-r--r-- | embassy-nrf/src/pwm.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index 8c4a5daea..5063c9457 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs | |||
| @@ -11,7 +11,8 @@ use crate::interrupt::Interrupt; | |||
| 11 | use crate::pac; | 11 | use crate::pac; |
| 12 | use crate::util::slice_in_ram_or; | 12 | use crate::util::slice_in_ram_or; |
| 13 | 13 | ||
| 14 | /// Interface to the PWM peripheral | 14 | /// SimplePwm is the traditional pwm interface you're probably used to, allowing |
| 15 | /// to simply set a duty cycle across up to four channels. | ||
| 15 | pub struct SimplePwm<'d, T: Instance> { | 16 | pub struct SimplePwm<'d, T: Instance> { |
| 16 | phantom: PhantomData<&'d mut T>, | 17 | phantom: PhantomData<&'d mut T>, |
| 17 | duty: [u16; 4], | 18 | duty: [u16; 4], |
| @@ -21,6 +22,8 @@ pub struct SimplePwm<'d, T: Instance> { | |||
| 21 | ch3: Option<AnyPin>, | 22 | ch3: Option<AnyPin>, |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 25 | /// SequencePwm allows you to offloader the updating of a sequence of duty | ||
| 26 | /// cycles to up to four channels, as well as repeat that sequence n times. | ||
| 24 | pub struct SequencePwm<'d, T: Instance> { | 27 | pub struct SequencePwm<'d, T: Instance> { |
| 25 | phantom: PhantomData<&'d mut T>, | 28 | phantom: PhantomData<&'d mut T>, |
| 26 | ch0: Option<AnyPin>, | 29 | ch0: Option<AnyPin>, |
| @@ -42,7 +45,7 @@ pub enum Error { | |||
| 42 | } | 45 | } |
| 43 | 46 | ||
| 44 | impl<'d, T: Instance> SequencePwm<'d, T> { | 47 | impl<'d, T: Instance> SequencePwm<'d, T> { |
| 45 | /// Creates the interface to a PWM Sequence interface. | 48 | /// Creates the interface to a `SequencePwm`. |
| 46 | /// | 49 | /// |
| 47 | /// Must be started by calling `start` | 50 | /// Must be started by calling `start` |
| 48 | /// | 51 | /// |
| @@ -329,7 +332,7 @@ pub enum CounterMode { | |||
| 329 | } | 332 | } |
| 330 | 333 | ||
| 331 | impl<'d, T: Instance> SimplePwm<'d, T> { | 334 | impl<'d, T: Instance> SimplePwm<'d, T> { |
| 332 | /// Creates the interface to a PWM instance. | 335 | /// Creates the interface to a `SimplePwm` |
| 333 | /// | 336 | /// |
| 334 | /// Defaults the freq to 1Mhz, max_duty 1000, duty 0, up mode, and pins low. | 337 | /// Defaults the freq to 1Mhz, max_duty 1000, duty 0, up mode, and pins low. |
| 335 | /// Must be started by calling `set_duty` | 338 | /// Must be started by calling `set_duty` |
