Trait embedded_hal::pwm::SetDutyCycle
source · pub trait SetDutyCycle: ErrorType {
// Required methods
fn get_max_duty_cycle(&self) -> u16;
fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>;
// Provided methods
fn set_duty_cycle_fully_off(&mut self) -> Result<(), Self::Error> { ... }
fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error> { ... }
fn set_duty_cycle_fraction(
&mut self,
num: u16,
denom: u16
) -> Result<(), Self::Error> { ... }
fn set_duty_cycle_percent(&mut self, percent: u8) -> Result<(), Self::Error> { ... }
}
Expand description
Single PWM channel / pin
Required Methods§
sourcefn get_max_duty_cycle(&self) -> u16
fn get_max_duty_cycle(&self) -> u16
Get the maximum duty cycle value.
This value corresponds to a 100% duty cycle.
Provided Methods§
sourcefn 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.
sourcefn 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.