Bläddra i källkod

Fix timer init.

Vladimir N. Shilov 2 år sedan
förälder
incheckning
ec50921bec
1 ändrade filer med 5 tillägg och 5 borttagningar
  1. 5 5
      Src/board.c

+ 5 - 5
Src/board.c

@@ -731,19 +731,19 @@ static void TIM16_Init(void)
   TIM16->ARR = TIM16_ARR; // auto reload value
   TIM16->CR1 = TIM_CR1_ARPE;
   // initial pwm value
-  //TIM16->CCR1 = TIM16_PWM_VAL;
+  //TIM16->CCR1 = TIM16_ARR/2; //TIM16_PWM_VAL;
   // pwm mode 1 for 1 chanel
-  TIM16->CCMR1 = (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1PE);
+  //TIM16->CCMR1 = (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1PE);
   // reset int flag
   TIM16->SR |= TIM_SR_UIF;
   TIM16->BDTR = TIM_BDTR_MOE; // enable main output
   TIM16->EGR = TIM_EGR_UG; // force timer update
   /* TIM16 CC_EnableChannel */
-  TIM16->CCER = TIM_CCER_CC1E;
-  /* TIM_EnableCounter */
-  TIM16->CR1 |= TIM_CR1_CEN;
+  //TIM16->CCER = TIM_CCER_CC1E;
   /* Enable IRQ */
   TIM16->DIER = TIM_DIER_UIE;
+  /* TIM_EnableCounter */
+  TIM16->CR1 |= TIM_CR1_CEN;
 }
 
 /**