Struct Operator

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

A MCPWM operator

The PWM Operator submodule has the following functions:

  • Generates a PWM signal pair, based on timing references obtained from the corresponding PWM timer.
  • Each signal out of the PWM signal pair includes a specific pattern of dead time. (Not yet implemented)
  • Superimposes a carrier on the PWM signal, if configured to do so. (Not yet implemented)
  • Handles response under fault conditions. (Not yet implemented)

Implementations§

Source§

impl<'d, const OP: u8, PWM: PwmPeripheral> Operator<'d, OP, PWM>

Source

pub fn set_timer<const TIM: u8>(&mut self, timer: &Timer<TIM, PWM>)

Select a Timer to be the timing reference for this operator

§Note:

By default TIMER0 is used

Source

pub fn with_pin_a( self, pin: impl Peripheral<P = impl PeripheralOutput> + 'd, config: PwmPinConfig<true>, ) -> PwmPin<'d, PWM, OP, true>

Use the A output with the given pin and configuration

Source

pub fn with_pin_b( self, pin: impl Peripheral<P = impl PeripheralOutput> + 'd, config: PwmPinConfig<false>, ) -> PwmPin<'d, PWM, OP, false>

Use the B output with the given pin and configuration

Source

pub fn with_pins( self, pin_a: impl Peripheral<P = impl PeripheralOutput> + 'd, config_a: PwmPinConfig<true>, pin_b: impl Peripheral<P = impl PeripheralOutput> + 'd, config_b: PwmPinConfig<false>, ) -> (PwmPin<'d, PWM, OP, true>, PwmPin<'d, PWM, OP, false>)

Use both the A and the B output with the given pins and configurations

Source

pub fn with_linked_pins( self, pin_a: impl Peripheral<P = impl PeripheralOutput> + 'd, config_a: PwmPinConfig<true>, pin_b: impl Peripheral<P = impl PeripheralOutput> + 'd, config_b: PwmPinConfig<false>, config_dt: DeadTimeCfg, ) -> LinkedPins<'d, PWM, OP>

Link two pins using the deadtime generator

This is useful for complementary or mirrored signals with or without configured deadtime

Auto Trait Implementations§

§

impl<'d, const OP: u8, PWM> Freeze for Operator<'d, OP, PWM>

§

impl<'d, const OP: u8, PWM> RefUnwindSafe for Operator<'d, OP, PWM>
where PWM: RefUnwindSafe,

§

impl<'d, const OP: u8, PWM> Send for Operator<'d, OP, PWM>
where PWM: Sync,

§

impl<'d, const OP: u8, PWM> Sync for Operator<'d, OP, PWM>
where PWM: Sync,

§

impl<'d, const OP: u8, PWM> Unpin for Operator<'d, OP, PWM>

§

impl<'d, const OP: u8, PWM> UnwindSafe for Operator<'d, OP, PWM>
where PWM: RefUnwindSafe,

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.