diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-05-15 00:02:50 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-05-17 00:57:37 +0200 |
| commit | 8394603ea6c76b29d1cb14f706e048eebbd933c3 (patch) | |
| tree | b55ca63c6fbd82c62267585a929b4fd81a40c586 /embassy-nrf/src | |
| parent | 88f664b434fd062faee923129d8814ef9c16036d (diff) | |
nrf/pwm: add enable/disable
Diffstat (limited to 'embassy-nrf/src')
| -rw-r--r-- | embassy-nrf/src/pwm.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/embassy-nrf/src/pwm.rs b/embassy-nrf/src/pwm.rs index ec589e8d1..4f500d722 100644 --- a/embassy-nrf/src/pwm.rs +++ b/embassy-nrf/src/pwm.rs | |||
| @@ -102,6 +102,20 @@ impl<'d, T: Instance> Pwm<'d, T> { | |||
| 102 | } | 102 | } |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | /// Enables the PWM generator. | ||
| 106 | #[inline(always)] | ||
| 107 | pub fn enable(&self) { | ||
| 108 | let r = T::regs(); | ||
| 109 | r.enable.write(|w| w.enable().enabled()); | ||
| 110 | } | ||
| 111 | |||
| 112 | /// Disables the PWM generator. | ||
| 113 | #[inline(always)] | ||
| 114 | pub fn disable(&self) { | ||
| 115 | let r = T::regs(); | ||
| 116 | r.enable.write(|w| w.enable().disabled()); | ||
| 117 | } | ||
| 118 | |||
| 105 | /// Sets duty cycle (15 bit) for a PWM channel. | 119 | /// Sets duty cycle (15 bit) for a PWM channel. |
| 106 | pub fn set_duty(&self, channel: usize, duty: u16) { | 120 | pub fn set_duty(&self, channel: usize, duty: u16) { |
| 107 | let s = T::state(); | 121 | let s = T::state(); |
