Struct HrPwmBuilder

Source
pub struct HrPwmBuilder<TIM, PSCL, PS, PINS, DacRst: DacResetTrigger = NoDacTrigger, DacStp: DacStepTrigger = NoDacTrigger> {
    pub pins: PINS,
    /* private fields */
}
Expand description

HrPwmBuilder is used to configure advanced HrTim PWM features

Fields§

§pins: PINS

Implementations§

Source§

impl<TIM: Instance + HrPwmAdvExt, PSCL, PINS, DacRst: DacResetTrigger, DacStp: DacStepTrigger> HrPwmBuilder<TIM, PSCL, TIM::PreloadSource, PINS, DacRst, DacStp>
where PSCL: HrtimPrescaler, PINS: ToHrOut<TIM>,

Source

pub fn prescaler<P>( self, _prescaler: P, ) -> HrPwmBuilder<TIM, P, TIM::PreloadSource, PINS, DacRst, DacStp>
where P: HrtimPrescaler,

Set the prescaler; PWM count runs at base_frequency/(prescaler+1)

Source

pub fn timer_mode(self, timer_mode: HrTimerMode) -> Self

Source

pub fn preload(self, preload_source: TIM::PreloadSource) -> Self

Source

pub fn period(self, period: u16) -> Self

Set the period; PWM count runs from 0 to period, repeating every (period+1) counts

Source

pub fn repetition_counter(self, repetition_counter: u8) -> Self

Set repetition counter, useful to reduce interrupts generated from timer by a factor (repetition_counter + 1)

Source

pub fn enable_repetition_interrupt(self) -> Self

Source

pub fn eev_cfg(self, eev_cfg: EevCfgs<TIM>) -> Self

Source

pub fn dac_trigger_cfg<R: DacResetTrigger, S: DacStepTrigger>( self, _rst: R, _step: S, ) -> HrPwmBuilder<TIM, PSCL, TIM::PreloadSource, PINS, R, S>

Enable dac trigger with provided settings

§Edge-aligned slope compensation

The DAC’s sawtooth starts on PWM period beginning and multiple triggers are generated during the timer period with a trigger interval equal to the CMP2 value.

NOTE: Must not be used simultaneously with modes using CMP2 (triple / quad interleaved and triggered-half modes). reset_trigger: DacRstTrg::OnCounterReset, step_trigger: DacStpTrg::OnCmp2,

§Center-aligned slope compensation

The DAC’s sawtooth starts on the output 1 set event and multiple triggers are generated during the timer period with a trigger interval equal to the CMP2 value.

NOTE: Must not be used simultaneously with modes using CMP2 (triple / quad interleaved and triggered-half modes).

NOTE: In centered-pattern mode, it is mandatory to have an even number of triggers per switching period, so as to avoid unevenly spaced triggers around counter’s peak value.

reset_trigger: DacRstTrg::OnOut1Set, step_trigger: DacStpTrg::OnCmp2,

§Hysteretic controller - Reset on CounterReset

2 triggers are generated per PWM period. In edge-aligned mode the triggers are generated on counter reset or rollover and the output is reset

reset_trigger: [DacResetOnCounterReset, step_trigger: [DacStepOnOut1Rst,

§Hysteretic controller - Reset on Out1Set

2 triggers are generated per PWM period. In center-aligned mode the triggers are generated when the output is set and when it is reset.

reset_trigger: DacResetOnOut1Set, step_trigger: DacStepOnOut1Rst,

Source§

impl<TIM: InstanceX, PSCL, PINS> HrPwmBuilder<TIM, PSCL, PreloadSource, PINS>
where PSCL: HrtimPrescaler, PINS: ToHrOut<TIM>,

Source

pub fn with_fault_source<FS>(self, _fault_source: FS) -> Self
where FS: FaultSource,

Source

pub fn fault_action1(self, fault_action1: FaultAction) -> Self

Source

pub fn fault_action2(self, fault_action2: FaultAction) -> Self

Source

pub fn out1_polarity(self, polarity: Polarity) -> Self

Source

pub fn out2_polarity(self, polarity: Polarity) -> Self

Source

pub fn push_pull_mode(self, enable: bool) -> Self

Enable or disable Push-Pull mode

Enabling Push-Pull mode will make output 1 and 2 alternate every period with one being inactive and the other getting to output its wave form as normal

     ----           .                ----

out1 | | . | | | | . | |


    .                ------         .                ------

out2 . | | . | | . | | . | |


NOTE: setting this will overide any ‘Swap Mode’ set

Source

pub fn counting_direction(self, counting_direction: HrCountingDirection) -> Self

Set counting direction

See HrCountingDirection

Source

pub fn interleaved_mode(self, mode: InterleavedMode) -> Self

Set interleaved or half modes

NOTE: Check InterleavedMode for more info about special cases

Source

pub fn deadtime(self, deadtime: DeadtimeConfig) -> Self

Source§

impl<PSCL, PINS, DacRst, DacStp> HrPwmBuilder<HRTIM_TIMA, PSCL, PreloadSource, PINS, DacRst, DacStp>
where DacRst: DacResetTrigger, DacStp: DacStepTrigger, PSCL: HrtimPrescaler, PINS: ToHrOut<HRTIM_TIMA, DacRst, DacStp>,

Source

pub fn _init(self, _control: &mut HrPwmControl) -> PINS

Source§

impl<PSCL, PINS, DacRst, DacStp> HrPwmBuilder<HRTIM_TIMB, PSCL, PreloadSource, PINS, DacRst, DacStp>
where DacRst: DacResetTrigger, DacStp: DacStepTrigger, PSCL: HrtimPrescaler, PINS: ToHrOut<HRTIM_TIMB, DacRst, DacStp>,

Source

pub fn _init(self, _control: &mut HrPwmControl) -> PINS

Source§

impl<PSCL, PINS, DacRst, DacStp> HrPwmBuilder<HRTIM_TIMC, PSCL, PreloadSource, PINS, DacRst, DacStp>
where DacRst: DacResetTrigger, DacStp: DacStepTrigger, PSCL: HrtimPrescaler, PINS: ToHrOut<HRTIM_TIMC, DacRst, DacStp>,

Source

pub fn _init(self, _control: &mut HrPwmControl) -> PINS

Source§

impl<PSCL, PINS, DacRst, DacStp> HrPwmBuilder<HRTIM_TIMD, PSCL, PreloadSource, PINS, DacRst, DacStp>
where DacRst: DacResetTrigger, DacStp: DacStepTrigger, PSCL: HrtimPrescaler, PINS: ToHrOut<HRTIM_TIMD, DacRst, DacStp>,

Source

pub fn _init(self, _control: &mut HrPwmControl) -> PINS

Source§

impl<PSCL, PINS, DacRst, DacStp> HrPwmBuilder<HRTIM_TIME, PSCL, PreloadSource, PINS, DacRst, DacStp>
where DacRst: DacResetTrigger, DacStp: DacStepTrigger, PSCL: HrtimPrescaler, PINS: ToHrOut<HRTIM_TIME, DacRst, DacStp>,

Source

pub fn _init(self, _control: &mut HrPwmControl) -> PINS

Source§

impl<PSCL, PINS, DacRst, DacStp> HrPwmBuilder<HRTIM_TIMF, PSCL, PreloadSource, PINS, DacRst, DacStp>
where DacRst: DacResetTrigger, DacStp: DacStepTrigger, PSCL: HrtimPrescaler, PINS: ToHrOut<HRTIM_TIMF, DacRst, DacStp>,

Source

pub fn _init(self, _control: &mut HrPwmControl) -> PINS

Source§

impl<PSCL, PINS, DacRst, DacStp> HrPwmBuilder<HRTIM_MASTER, PSCL, MasterPreloadSource, PINS, DacRst, DacStp>
where DacRst: DacResetTrigger, DacStp: DacStepTrigger, PSCL: HrtimPrescaler, PINS: ToHrOut<HRTIM_MASTER>,

Source

pub fn finalize( self, _control: &mut HrPwmControl, ) -> HrParts<HRTIM_MASTER, PSCL, PINS>

Auto Trait Implementations§

§

impl<TIM, PSCL, PS, PINS, DacRst, DacStp> Freeze for HrPwmBuilder<TIM, PSCL, PS, PINS, DacRst, DacStp>
where PINS: Freeze, PS: Freeze,

§

impl<TIM, PSCL, PS, PINS, DacRst, DacStp> RefUnwindSafe for HrPwmBuilder<TIM, PSCL, PS, PINS, DacRst, DacStp>
where PINS: RefUnwindSafe, TIM: RefUnwindSafe, PSCL: RefUnwindSafe, PS: RefUnwindSafe, DacRst: RefUnwindSafe, DacStp: RefUnwindSafe,

§

impl<TIM, PSCL, PS, PINS, DacRst, DacStp> Send for HrPwmBuilder<TIM, PSCL, PS, PINS, DacRst, DacStp>
where PINS: Send, TIM: Send, PSCL: Send, PS: Send, DacRst: Send, DacStp: Send,

§

impl<TIM, PSCL, PS, PINS, DacRst, DacStp> Sync for HrPwmBuilder<TIM, PSCL, PS, PINS, DacRst, DacStp>
where PINS: Sync, TIM: Sync, PSCL: Sync, PS: Sync, DacRst: Sync, DacStp: Sync,

§

impl<TIM, PSCL, PS, PINS, DacRst, DacStp> Unpin for HrPwmBuilder<TIM, PSCL, PS, PINS, DacRst, DacStp>
where PINS: Unpin, TIM: Unpin, PSCL: Unpin, PS: Unpin, DacRst: Unpin, DacStp: Unpin,

§

impl<TIM, PSCL, PS, PINS, DacRst, DacStp> UnwindSafe for HrPwmBuilder<TIM, PSCL, PS, PINS, DacRst, DacStp>
where PINS: UnwindSafe, TIM: UnwindSafe, PSCL: UnwindSafe, PS: UnwindSafe, DacRst: UnwindSafe, DacStp: 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>,

Source§

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>,

Source§

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.