changed for STM32F4

Fork of FastPWM by Erik -

Files at this revision

API Documentation at this revision

Comitter:
Sissors
Date:
Thu Apr 16 19:23:53 2015 +0000
Parent:
21:aa2884be5496
Child:
23:ed690a19dc55
Commit message:
Fixed a bug for STM targets. The mbed library did not enable syncing of the period register, resulting in sometimes a smaller period being set than the current timer value -> it would first need to overflow before it worked properly. Which takes long o...

Changed in this revision

Device/FastPWM_STM_TIM.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Device/FastPWM_STM_TIM.cpp	Mon Jan 12 10:31:18 2015 +0000
+++ b/Device/FastPWM_STM_TIM.cpp	Thu Apr 16 19:23:53 2015 +0000
@@ -19,6 +19,9 @@
     fast_obj = new (CHANNEL_P_T);
     *(CHANNEL_P_T*)fast_obj = getChannel(PWM_TIMER, _pwm.pin);
     
+    //Enable PWM period syncing for glitch free result
+    PWM_TIMER->CR1 |= TIM_CR1_ARPE;
+    
     bits = 16;
 }