diff --git a/my_src/inverter.c b/my_src/inverter.c index 78f21df..80428d0 100644 --- a/my_src/inverter.c +++ b/my_src/inverter.c @@ -108,10 +108,12 @@ void inverterStart(uint8_t freqOut, direction_t direction) { timerSupport[i].running = false; HAL_GPIO_WritePin(timerSupport[i].bridgePolarityPort, timerSupport[i].bridgePolarityPin, GPIO_PIN_RESET); __HAL_TIM_SET_AUTORELOAD(timerSupport[i].handle, slotWidth); + __HAL_TIM_SET_COUNTER(timerSupport[i].handle, 0); } timer1Cnt = 0; __HAL_TIM_SET_AUTORELOAD(&htim1, slotWidth); + __HAL_TIM_SET_COUNTER(&htim1, 0); HAL_TIM_Base_Start_IT(&htim1); __HAL_TIM_ENABLE_IT(&htim1, TIM_IT_UPDATE); }