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