Struct esp32_hal::mcpwm::operator::DeadTimeCfg
source · pub struct DeadTimeCfg { /* private fields */ }
Expand description
Configuration for MCPWM Operator DeadTime It’s recommended to reference the technical manual for configuration
Implementations§
source§impl DeadTimeCfg
impl DeadTimeCfg
sourcepub fn new_bypass() -> DeadTimeCfg
pub fn new_bypass() -> DeadTimeCfg
Uses the following configuration:
- Clock: PWM_clk
- Bypass: A & B
- Inputs: A->A, B->B (InSel)
- Outputs: A->A, B->B (OutSwap)
- No Dual-edge B
- No Invert
- FED/RED update mode = immediate
- FED/RED = 0
sourcepub fn new_ahc(red_delay: Option<u16>, fed_delay: Option<u16>) -> DeadTimeCfg
pub fn new_ahc(red_delay: Option<u16>, fed_delay: Option<u16>) -> DeadTimeCfg
Active High Complementary (AHC) from Technical Reference manual
Will generate a PWM from input PWMA, such that output PWMA & PWMB are each others complement Except during a transition in which they will be both off (as deadtime) such that they should never overlap, useful for H-Bridge type scenarios
Default delay on both rising (red) and falling (fed) edge is 16 cycles
sourcepub fn set_delay(&mut self, rising_edge: u16, falling_edge: u16)
pub fn set_delay(&mut self, rising_edge: u16, falling_edge: u16)
Sets the delay for the FED/RED module
sourcepub fn invert_output(&mut self, fed: bool, red: bool)
pub fn invert_output(&mut self, fed: bool, red: bool)
Sets FED/RED output inverter Inverts the output of the FED/RED module (excl DEB mode feedback)
sourcepub fn set_output_swap(&mut self, stream: PWMStream, swap: bool)
pub fn set_output_swap(&mut self, stream: PWMStream, swap: bool)
Swaps the output of a PWM Stream i.e. If streams have output_swap enabled, the output of the module is swapped, while if only one is enabled that one ‘copies’ from the other stream
sourcepub fn set_bypass(&mut self, stream: PWMStream, enable: bool)
pub fn set_bypass(&mut self, stream: PWMStream, enable: bool)
Set PWMA/PWMB stream to bypass everything except output_swap This means no deadtime is applied when enabled
sourcepub fn select_clock(&mut self, pwm_clock: bool)
pub fn select_clock(&mut self, pwm_clock: bool)
Select Between PWMClk & PT_Clk
sourcepub fn select_input(&mut self, fed: PWMStream, red: PWMStream)
pub fn select_input(&mut self, fed: PWMStream, red: PWMStream)
Select which stream is used for the input of FED/RED