Struct imxrt_hal::flexpwm::Output

source ·
pub struct Output<P> { /* private fields */ }
Expand description

A PWM output pin.

Provides a simple interface for configuring a PWM pin, and for defining the turn on and turn off count values. Use new_a or new_b to create your PWM outputs (depending on the PWM pin’s function).

The behaviors of the output pin depend on the submodule’s configurations. Make sure you configure your PWM output pair operations with Submodule::set_pair_operation. to ensure this output functions as expected.

Implementations§

source§

impl<P, const N: u8, const M: u8> Output<P>
where P: Pin<Module = Const<N>, Output = A, Submodule = Const<M>>,

source

pub fn new_a(pin: P) -> Self

Create a PWM A channel output.

source§

impl<P, const N: u8, const M: u8> Output<P>
where P: Pin<Module = Const<N>, Output = B, Submodule = Const<M>>,

source

pub fn new_b(pin: P) -> Self

Create a PWM B channel output.

source§

impl<P, const N: u8, const M: u8> Output<P>
where P: Pin<Module = Const<N>, Submodule = Const<M>>,

source

pub fn release(self, pwm: &mut Pwm<N>) -> P

Release the PWM pin.

This call disables the PWM output on the pin.

source

pub fn output_enable(&self, pwm: &Pwm<N>) -> bool

Indicates if this ouput is enabled.

source

pub fn set_output_enable(&self, pwm: &mut Pwm<N>, enable: bool)

Enable or disable this output.

source

pub fn turn_on(&self, sm: &Submodule<N, M>) -> i16

Returns the turn on counter value.

When the PWM counter reaches this value, the output sets.

source

pub fn turn_off(&self, sm: &Submodule<N, M>) -> i16

Returns the turn off counter value.

When the PWM counter reaches this value, the output clears.

source

pub fn set_turn_on(&self, sm: &Submodule<N, M>, compare: i16)

Set the turn on counter value.

source

pub fn set_turn_off(&self, sm: &Submodule<N, M>, compare: i16)

Set the turn off counter value.

Auto Trait Implementations§

§

impl<P> RefUnwindSafe for Output<P>
where P: RefUnwindSafe,

§

impl<P> Send for Output<P>
where P: Send,

§

impl<P> Sync for Output<P>
where P: Sync,

§

impl<P> Unpin for Output<P>
where P: Unpin,

§

impl<P> UnwindSafe for Output<P>
where P: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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.
source§

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

Performs the conversion.