pub struct SinglePwm<'d> { /* private fields */ }Expand description
Single channel PWM driver
A single channel is used for Duty Cycle and a single channel is used for PWM period match.
Implementations§
Source§impl<'d> SinglePwm<'d>
impl<'d> SinglePwm<'d>
Sourcepub fn new<T: Instance, DUTY: CTimerChannel<T>, PIN: OutputPin<T>>(
ctimer: CTimer<'d>,
duty_ch: Peri<'d, DUTY>,
period_ch: Peri<'d, impl CTimerChannel<T>>,
pin: Peri<'d, PIN>,
config: Config,
) -> Result<Self, PwmError>where
(T, DUTY, PIN): ValidMatchConfig,
pub fn new<T: Instance, DUTY: CTimerChannel<T>, PIN: OutputPin<T>>(
ctimer: CTimer<'d>,
duty_ch: Peri<'d, DUTY>,
period_ch: Peri<'d, impl CTimerChannel<T>>,
pin: Peri<'d, PIN>,
config: Config,
) -> Result<Self, PwmError>where
(T, DUTY, PIN): ValidMatchConfig,
Create Pwm driver with a single pin as output.
Upon Drop, the external pin will be placed into Disabled
state.
Trait Implementations§
Source§impl<'d> SetDutyCycle for SinglePwm<'d>
impl<'d> SetDutyCycle for SinglePwm<'d>
Source§fn max_duty_cycle(&self) -> u16
fn max_duty_cycle(&self) -> u16
Get the maximum duty cycle value. Read more
Source§fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
Set the duty cycle to
duty / max_duty. Read moreSource§fn set_duty_cycle_fully_off(&mut self) -> Result<(), Self::Error>
fn set_duty_cycle_fully_off(&mut self) -> Result<(), Self::Error>
Set the duty cycle to 0%, or always inactive.
Source§fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error>
fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error>
Set the duty cycle to 100%, or always active.
Auto Trait Implementations§
impl<'d> Freeze for SinglePwm<'d>
impl<'d> !RefUnwindSafe for SinglePwm<'d>
impl<'d> Send for SinglePwm<'d>
impl<'d> Sync for SinglePwm<'d>
impl<'d> Unpin for SinglePwm<'d>
impl<'d> !UnwindSafe for SinglePwm<'d>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more