pub struct LedcDriver<'d> { /* private fields */ }
Expand description

LED Control driver

Implementations§

source§

impl<'d> LedcDriver<'d>

source

pub fn new<C, B>( _channel: impl Peripheral<P = C> + 'd, timer_driver: B, pin: impl Peripheral<P = impl OutputPin> + 'd ) -> Result<LedcDriver<'d>, EspError>
where C: LedcChannel, B: Borrow<LedcTimerDriver<'d>>,

Creates a new LED Control driver

source

pub fn get_duty(&self) -> u32

source

pub fn get_hpoint(&self) -> u32

source

pub fn get_max_duty(&self) -> u32

source

pub fn disable(&mut self) -> Result<(), EspError>

source

pub fn enable(&mut self) -> Result<(), EspError>

source

pub fn set_duty(&mut self, duty: u32) -> Result<(), EspError>

source

pub fn set_hpoint(&mut self, hpoint: u32) -> Result<(), EspError>

source

pub fn set_duty_with_hpoint( &mut self, duty: u32, hpoint: u32 ) -> Result<(), EspError>

source

pub fn channel(&self) -> u32

source

pub fn timer(&self) -> u32

Trait Implementations§

source§

impl<'d> Drop for LedcDriver<'d>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'d> ErrorType for LedcDriver<'d>

§

type Error = PwmError

Error type
source§

impl<'d> PwmPin for LedcDriver<'d>

§

type Duty = u32

Type for the duty methods Read more
source§

fn disable(&mut self)

Disables a PWM channel
source§

fn enable(&mut self)

Enables a PWM channel
source§

fn get_duty(&self) -> <LedcDriver<'d> as PwmPin>::Duty

Returns the current duty cycle
source§

fn get_max_duty(&self) -> <LedcDriver<'d> as PwmPin>::Duty

Returns the maximum duty cycle value
source§

fn set_duty(&mut self, duty: u32)

Sets a new duty cycle
source§

impl<'d> SetDutyCycle for LedcDriver<'d>

source§

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>

Set the duty cycle to duty / max_duty. Read more
source§

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>

Set the duty cycle to 0%, or always inactive.
source§

fn set_duty_cycle_fraction( &mut self, num: u16, denom: u16 ) -> Result<(), PwmError>

Set the duty cycle to num / denom. Read more
source§

fn set_duty_cycle_percent(&mut self, percent: u8) -> Result<(), PwmError>

Set the duty cycle to percent / 100 Read more
source§

impl<'d> Send for LedcDriver<'d>

Auto Trait Implementations§

§

impl<'d> RefUnwindSafe for LedcDriver<'d>

§

impl<'d> Sync for LedcDriver<'d>

§

impl<'d> Unpin for LedcDriver<'d>

§

impl<'d> !UnwindSafe for LedcDriver<'d>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.