Struct esp_idf_svc::hal::ledc::LedcDriver
source · 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<'d> Drop for LedcDriver<'d>
impl<'d> Drop for LedcDriver<'d>
source§impl<'d> PwmPin for LedcDriver<'d>
impl<'d> PwmPin for LedcDriver<'d>
source§fn get_max_duty(&self) -> <LedcDriver<'d> as PwmPin>::Duty
fn get_max_duty(&self) -> <LedcDriver<'d> as PwmPin>::Duty
Returns the maximum duty cycle value
source§impl<'d> SetDutyCycle for LedcDriver<'d>
impl<'d> SetDutyCycle for LedcDriver<'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<(), 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