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>,
impl<TIM: Instance + HrPwmAdvExt, PSCL, PINS, DacRst: DacResetTrigger, DacStp: DacStepTrigger> HrPwmBuilder<TIM, PSCL, TIM::PreloadSource, PINS, DacRst, DacStp>where
PSCL: HrtimPrescaler,
PINS: ToHrOut<TIM>,
Sourcepub fn prescaler<P>(
self,
_prescaler: P,
) -> HrPwmBuilder<TIM, P, TIM::PreloadSource, PINS, DacRst, DacStp>where
P: HrtimPrescaler,
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)
pub fn timer_mode(self, timer_mode: HrTimerMode) -> Self
pub fn preload(self, preload_source: TIM::PreloadSource) -> Self
Sourcepub fn period(self, period: u16) -> Self
pub fn period(self, period: u16) -> Self
Set the period; PWM count runs from 0 to period, repeating every (period+1) counts
Sourcepub fn repetition_counter(self, repetition_counter: u8) -> Self
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)
pub fn enable_repetition_interrupt(self) -> Self
pub fn eev_cfg(self, eev_cfg: EevCfgs<TIM>) -> Self
Sourcepub fn dac_trigger_cfg<R: DacResetTrigger, S: DacStepTrigger>(
self,
_rst: R,
_step: S,
) -> HrPwmBuilder<TIM, PSCL, TIM::PreloadSource, PINS, R, S>
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>,
impl<TIM: InstanceX, PSCL, PINS> HrPwmBuilder<TIM, PSCL, PreloadSource, PINS>where
PSCL: HrtimPrescaler,
PINS: ToHrOut<TIM>,
pub fn with_fault_source<FS>(self, _fault_source: FS) -> Selfwhere
FS: FaultSource,
pub fn fault_action1(self, fault_action1: FaultAction) -> Self
pub fn fault_action2(self, fault_action2: FaultAction) -> Self
pub fn out1_polarity(self, polarity: Polarity) -> Self
pub fn out2_polarity(self, polarity: Polarity) -> Self
Sourcepub fn push_pull_mode(self, enable: bool) -> Self
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
Sourcepub fn counting_direction(self, counting_direction: HrCountingDirection) -> Self
pub fn counting_direction(self, counting_direction: HrCountingDirection) -> Self
Set counting direction
Sourcepub fn interleaved_mode(self, mode: InterleavedMode) -> Self
pub fn interleaved_mode(self, mode: InterleavedMode) -> Self
Set interleaved or half modes
NOTE: Check InterleavedMode
for more info about special cases