Struct PwmPin

Source
pub struct PwmPin<'d, PWM, const OP: u8, const IS_A: bool> { /* private fields */ }
Available on crate feature unstable only.
Expand description

A pin driven by an MCPWM operator

Implementations§

Source§

impl<'d, PWM: PwmPeripheral, const OP: u8, const IS_A: bool> PwmPin<'d, PWM, OP, IS_A>

Source

pub fn set_actions(&mut self, value: PwmActions<IS_A>)

Configure what actions should be taken on timing events

Source

pub fn set_update_method(&mut self, update_method: PwmUpdateMethod)

Set how a new timestamp syncs with the timer

Source

pub fn set_timestamp(&mut self, value: u16)

Write a new timestamp. The written value will take effect according to the set PwmUpdateMethod.

Source

pub fn timestamp(&self) -> u16

Get the old timestamp. The value of the timestamp will take effect according to the set PwmUpdateMethod.

Source

pub fn period(&self) -> u16

Get the period of the timer.

Trait Implementations§

Source§

impl<PWM: PwmPeripheral, const OP: u8, const IS_A: bool> ErrorType for PwmPin<'_, PWM, OP, IS_A>

Implement no error type for the PwmPin because the method are infallible

Source§

type Error = Infallible

Error type
Source§

impl<PWM: PwmPeripheral, const OP: u8, const IS_A: bool> SetDutyCycle for PwmPin<'_, PWM, OP, IS_A>

Implement the trait SetDutyCycle for PwmPin

Source§

fn max_duty_cycle(&self) -> u16

Get the max duty of the PwmPin

Source§

fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Infallible>

Set the max duty of the PwmPin

Source§

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

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

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

Set the duty cycle to 100%, or always active.
Source§

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

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

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

Set the duty cycle to percent / 100 Read more

Auto Trait Implementations§

§

impl<'d, PWM, const OP: u8, const IS_A: bool> Freeze for PwmPin<'d, PWM, OP, IS_A>

§

impl<'d, PWM, const OP: u8, const IS_A: bool> RefUnwindSafe for PwmPin<'d, PWM, OP, IS_A>
where PWM: RefUnwindSafe,

§

impl<'d, PWM, const OP: u8, const IS_A: bool> Send for PwmPin<'d, PWM, OP, IS_A>
where PWM: Send,

§

impl<'d, PWM, const OP: u8, const IS_A: bool> Sync for PwmPin<'d, PWM, OP, IS_A>
where PWM: Sync,

§

impl<'d, PWM, const OP: u8, const IS_A: bool> Unpin for PwmPin<'d, PWM, OP, IS_A>
where PWM: Unpin,

§

impl<'d, PWM, const OP: u8, const IS_A: bool> !UnwindSafe for PwmPin<'d, PWM, OP, IS_A>

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.