[][src]Trait embedded_hal::pwm::PwmPin

pub trait PwmPin {
    type Error;
    type Duty;
    fn try_disable(&mut self) -> Result<(), Self::Error>;
fn try_enable(&mut self) -> Result<(), Self::Error>;
fn try_get_duty(&self) -> Result<Self::Duty, Self::Error>;
fn try_get_max_duty(&self) -> Result<Self::Duty, Self::Error>;
fn try_set_duty(&mut self, duty: Self::Duty) -> Result<(), Self::Error>; }

A single PWM channel / pin

See Pwm for details

Associated Types

type Error

Enumeration of PwmPin errors

type Duty

Type for the duty methods

The implementer is free to choose a float / percentage representation (e.g. 0.0 .. 1.0) or an integer representation (e.g. 0 .. 65535)

Loading content...

Required methods

fn try_disable(&mut self) -> Result<(), Self::Error>

Disables a PWM channel

fn try_enable(&mut self) -> Result<(), Self::Error>

Enables a PWM channel

fn try_get_duty(&self) -> Result<Self::Duty, Self::Error>

Returns the current duty cycle

While the pin is transitioning to the new duty cycle after a try_set_duty call, this may return the old or the new duty cycle depending on the implementation.

fn try_get_max_duty(&self) -> Result<Self::Duty, Self::Error>

Returns the maximum duty cycle value

fn try_set_duty(&mut self, duty: Self::Duty) -> Result<(), Self::Error>

Sets a new duty cycle

Loading content...

Implementors

Loading content...