mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Revision:
554:edd95c0879f8
Parent:
548:1abac31e188e
Child:
556:a217bc785985
--- a/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/pwmout_api.c	Mon Jun 01 10:30:08 2015 +0100
+++ b/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/pwmout_api.c	Mon Jun 01 11:00:11 2015 +0100
@@ -139,7 +139,7 @@
         value = 1;
     }
 
-    float pulse_period_in_s = obj->period_cycles / (float) pwm_clockfreq;
+    float pulse_period_in_s = obj->period_cycles / ((float) (pwm_clockfreq >> pwm_prescaler_div));
     pwmout_pulsewidth(obj, value * pulse_period_in_s);
 }
 
@@ -192,7 +192,7 @@
 
 void pwmout_pulsewidth(pwmout_t *obj, float seconds)
 {
-    obj->width_cycles = pwm_clockfreq * seconds;
+    obj->width_cycles = (uint32_t) (((float) (pwm_clockfreq >> pwm_prescaler_div)) * seconds);
     TIMER_CompareBufSet(PWM_TIMER, obj->channel, obj->width_cycles);
 }