PWM Timer1 okay

This commit is contained in:
leo 2025-12-01 22:13:59 +01:00
parent 0669098ea8
commit 30531c18dc

View file

@ -63,6 +63,7 @@ void Mytimer_PWM(TIM_TypeDef *Timer, char Channel){
}
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;
else if (Channel == 2) Timer->CCR2 = Timer->ARR*pulse/100;
else if (Channel == 3) Timer->CCR3 = (Timer->ARR)*pulse/100;