pub struct SimplePwmChannel<'d> { /* private fields */ }Expand description
A single channel of a SimplePwm.
Obtained with SimplePwm::ch0..SimplePwm::ch3 (borrowing the PWM) or
SimplePwm::split (owning the channel’s pin), so channels can be handed to different tasks.
Implementations§
Source§impl<'d> SimplePwmChannel<'d>
impl<'d> SimplePwmChannel<'d>
Sourcepub fn set_duty(&mut self, duty: DutyCycle)
pub fn set_duty(&mut self, duty: DutyCycle)
Sets the duty cycle (15 bit) and polarity of the channel.
Sourcepub fn max_duty_cycle(&self) -> u16
pub fn max_duty_cycle(&self) -> u16
Returns the maximum duty cycle value.
Sourcepub fn set_drive(&mut self, drive: OutputDrive)
pub fn set_drive(&mut self, drive: OutputDrive)
Sets the output drive strength of the channel’s pin.
Does nothing for a channel obtained via SimplePwm::ch0..SimplePwm::ch3 whose
pin is still owned by the SimplePwm; use SimplePwm::set_ch0_drive etc. instead.
Trait Implementations§
Source§impl<'d> Drop for SimplePwmChannel<'d>
impl<'d> Drop for SimplePwmChannel<'d>
Source§impl<'d> SetDutyCycle for SimplePwmChannel<'d>
impl<'d> SetDutyCycle for SimplePwmChannel<'d>
Source§fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
Sets the duty cycle, as the number of counter ticks the output is high per period.
This uses the DutyCycle::inverted polarity so that 0 is fully off and
max_duty_cycle is fully on.
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_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> !UnwindSafe for SimplePwmChannel<'d>
impl<'d> Freeze for SimplePwmChannel<'d>
impl<'d> RefUnwindSafe for SimplePwmChannel<'d>
impl<'d> Send for SimplePwmChannel<'d>
impl<'d> Sync for SimplePwmChannel<'d>
impl<'d> Unpin for SimplePwmChannel<'d>
impl<'d> UnsafeUnpin for SimplePwmChannel<'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