implement retriving duty.
Description: When disabling the pwm and enabling again, it is required to restart the sequence. If the previous duty is not known, it is not possible to turn on the pwm again
This commit is contained in:
@ -736,6 +736,11 @@ impl<'d, T: Instance> SimplePwm<'d, T> {
|
|||||||
r.enable.write(|w| w.enable().disabled());
|
r.enable.write(|w| w.enable().disabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the current duty of the channel
|
||||||
|
pub fn duty(&self, channel: usize) -> u16 {
|
||||||
|
self.duty[channel]
|
||||||
|
}
|
||||||
|
|
||||||
/// Sets duty cycle (15 bit) for a PWM channel.
|
/// Sets duty cycle (15 bit) for a PWM channel.
|
||||||
pub fn set_duty(&mut self, channel: usize, duty: u16) {
|
pub fn set_duty(&mut self, channel: usize, duty: u16) {
|
||||||
let r = T::regs();
|
let r = T::regs();
|
||||||
|
Reference in New Issue
Block a user