|
@ -50,15 +50,12 @@ void ZPWMGenerator::startPWM(float freq, float duty) { |
|
|
Error_Handler(); |
|
|
Error_Handler(); |
|
|
} |
|
|
} |
|
|
HAL_TIM_PWM_Stop(m_htim, m_channel); |
|
|
HAL_TIM_PWM_Stop(m_htim, m_channel); |
|
|
|
|
|
__HAL_TIM_SET_COUNTER(m_htim, 0); |
|
|
if (HAL_TIM_PWM_Start(m_htim, m_channel) != HAL_OK) { |
|
|
if (HAL_TIM_PWM_Start(m_htim, m_channel) != HAL_OK) { |
|
|
Error_Handler(); |
|
|
Error_Handler(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
void ZPWMGenerator::stopPWM() { |
|
|
void ZPWMGenerator::stopPWM() { |
|
|
float duty = 0; |
|
|
float duty = 0; |
|
|
if (!m_polarity) { |
|
|
|
|
|
duty = 100.0 - duty; |
|
|
|
|
|
} |
|
|
|
|
|
// HAL_TIM_PWM_Stop(m_htim, m_channel);
|
|
|
|
|
|
startPWM(duty); |
|
|
startPWM(duty); |
|
|
} |
|
|
} |