aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c')
-rw-r--r--os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c b/os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c
index a59105215..6bf31ebc0 100644
--- a/os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c
+++ b/os/hal/ports/STM32/LLD/TIMv1/hal_pwm_lld.c
@@ -771,8 +771,8 @@ void pwm_lld_enable_periodic_notification(PWMDriver *pwmp) {
/* If the IRQ is not already enabled care must be taken to clear it,
it is probably already pending because the timer is running.*/
if ((dier & STM32_TIM_DIER_UIE) == 0) {
+ pwmp->tim->SR = ~STM32_TIM_SR_UIF;
pwmp->tim->DIER = dier | STM32_TIM_DIER_UIE;
- pwmp->tim->SR &= STM32_TIM_SR_UIF;
}
}
@@ -813,8 +813,8 @@ void pwm_lld_enable_channel_notification(PWMDriver *pwmp,
/* If the IRQ is not already enabled care must be taken to clear it,
it is probably already pending because the timer is running.*/
if ((dier & (2 << channel)) == 0) {
- pwmp->tim->DIER = dier | (2 << channel);
pwmp->tim->SR = ~(2 << channel);
+ pwmp->tim->DIER = dier | (2 << channel);
}
}