pub struct LedcDriver<'d> { /* private fields */ }Expand description
LED Control driver
Implementations§
Source§impl<'d> LedcDriver<'d>
 
impl<'d> LedcDriver<'d>
Sourcepub fn new<C, T, B>(
    _channel: impl Peripheral<P = C> + 'd,
    timer_driver: B,
    pin: impl Peripheral<P = impl OutputPin> + 'd,
) -> Result<LedcDriver<'d>, EspError>where
    C: LedcChannel<SpeedMode = <T as LedcTimer>::SpeedMode>,
    T: LedcTimer + 'd,
    B: Borrow<LedcTimerDriver<'d, T>>,
 
pub fn new<C, T, B>(
    _channel: impl Peripheral<P = C> + 'd,
    timer_driver: B,
    pin: impl Peripheral<P = impl OutputPin> + 'd,
) -> Result<LedcDriver<'d>, EspError>where
    C: LedcChannel<SpeedMode = <T as LedcTimer>::SpeedMode>,
    T: LedcTimer + 'd,
    B: Borrow<LedcTimerDriver<'d, T>>,
Creates a new LED Control driver
Sourcepub fn config_with_pin(
    &mut self,
    pin: impl Peripheral<P = impl OutputPin> + 'd,
) -> Result<(), EspError>
 
pub fn config_with_pin( &mut self, pin: impl Peripheral<P = impl OutputPin> + 'd, ) -> Result<(), EspError>
Applies LEDC configuration with a specific pin Can be used to reconfigure the LEDC driver with a different pin
pub fn get_duty(&self) -> u32
pub fn get_hpoint(&self) -> u32
pub fn get_max_duty(&self) -> u32
pub fn disable(&mut self) -> Result<(), EspError>
pub fn enable(&mut self) -> Result<(), EspError>
pub fn set_duty(&mut self, duty: u32) -> Result<(), EspError>
pub fn set_hpoint(&mut self, hpoint: u32) -> Result<(), EspError>
pub fn set_duty_with_hpoint( &mut self, duty: u32, hpoint: u32, ) -> Result<(), EspError>
pub fn channel(&self) -> u32
pub fn timer(&self) -> u32
Trait Implementations§
Source§impl Drop for LedcDriver<'_>
 
impl Drop for LedcDriver<'_>
Source§impl PwmPin for LedcDriver<'_>
 
impl PwmPin for LedcDriver<'_>
Source§fn get_max_duty(&self) -> <LedcDriver<'_> as PwmPin>::Duty
 
fn get_max_duty(&self) -> <LedcDriver<'_> as PwmPin>::Duty
Returns the maximum duty cycle value
Source§impl SetDutyCycle for LedcDriver<'_>
 
impl SetDutyCycle for LedcDriver<'_>
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<(), PwmError>
 
fn set_duty_cycle(&mut self, duty: u16) -> Result<(), PwmError>
Set the duty cycle to 
duty / max_duty. Read moreSource§fn set_duty_cycle_fully_on(&mut self) -> Result<(), PwmError>
 
fn set_duty_cycle_fully_on(&mut self) -> Result<(), PwmError>
Set the duty cycle to 100%, or always active.
Source§fn set_duty_cycle_fully_off(&mut self) -> Result<(), PwmError>
 
fn set_duty_cycle_fully_off(&mut self) -> Result<(), PwmError>
Set the duty cycle to 0%, or always inactive.
Source§fn set_duty_cycle_fraction(
    &mut self,
    num: u16,
    denom: u16,
) -> Result<(), PwmError>
 
fn set_duty_cycle_fraction( &mut self, num: u16, denom: u16, ) -> Result<(), PwmError>
Set the duty cycle to 
num / denom. Read moreSource§fn set_duty_cycle_percent(&mut self, percent: u8) -> Result<(), PwmError>
 
fn set_duty_cycle_percent(&mut self, percent: u8) -> Result<(), PwmError>
Set the duty cycle to 
percent / 100 Read more