nrf/pwm: add enable/disable

This commit is contained in:
Dario Nieuwenhuis 2021-05-15 00:02:50 +02:00
parent 88f664b434
commit 8394603ea6

View file

@ -102,6 +102,20 @@ impl<'d, T: Instance> Pwm<'d, T> {
}
}
/// Enables the PWM generator.
#[inline(always)]
pub fn enable(&self) {
let r = T::regs();
r.enable.write(|w| w.enable().enabled());
}
/// Disables the PWM generator.
#[inline(always)]
pub fn disable(&self) {
let r = T::regs();
r.enable.write(|w| w.enable().disabled());
}
/// Sets duty cycle (15 bit) for a PWM channel.
pub fn set_duty(&self, channel: usize, duty: u16) {
let s = T::state();