This commit is contained in:
Cedric Chanfreau 2023-03-22 16:56:22 +01:00
parent f22d8aacd9
commit c404ceeab2

View file

@ -42,5 +42,5 @@ void MyTimer_PWM( MyTimer_Struct_TypeDef * Timer, uint16_t cycle){
Timer->Timer->CCER |= TIM_CCER_CC1E; // Canal CH1 validé par bit CC1E (registre CCER) Timer->Timer->CCER |= TIM_CCER_CC1E; // Canal CH1 validé par bit CC1E (registre CCER)
Timer->Timer->CR1 |= TIM_CR1_CEN; // Lancement du timer Timer->Timer->CR1 |= TIM_CR1_CEN; // Lancement du timer
Timer->Timer->CCR1 = (cycle * Timer->ARR) / 100; // Fixer la durée à 20% Timer->Timer->CCR1 = (cycle * Timer->ARR) / 100; // Fixer la durée à 20%
} }