PWM Timer1 okay
This commit is contained in:
parent
0669098ea8
commit
30531c18dc
1 changed files with 1 additions and 0 deletions
|
|
@ -63,6 +63,7 @@ void Mytimer_PWM(TIM_TypeDef *Timer, char Channel){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mytimer_PWM_cycle(TIM_TypeDef *Timer, char Channel, int pulse){
|
void Mytimer_PWM_cycle(TIM_TypeDef *Timer, char Channel, int pulse){
|
||||||
|
if (Timer==TIM1) Timer->BDTR |= TIM_BDTR_MOE;
|
||||||
if (Channel == 1) Timer->CCR1 = Timer->ARR*pulse/100;
|
if (Channel == 1) Timer->CCR1 = Timer->ARR*pulse/100;
|
||||||
else if (Channel == 2) Timer->CCR2 = Timer->ARR*pulse/100;
|
else if (Channel == 2) Timer->CCR2 = Timer->ARR*pulse/100;
|
||||||
else if (Channel == 3) Timer->CCR3 = (Timer->ARR)*pulse/100;
|
else if (Channel == 3) Timer->CCR3 = (Timer->ARR)*pulse/100;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue