mbed library sources modified for open wear

Dependents:   openwear-lifelogger-example

Fork of mbed-src by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Wed Jul 23 08:45:10 2014 +0100
Parent:
263:3095fd66fd32
Child:
265:9632ea190e16
Commit message:
Synchronized with git revision 6663575abc7a56be6750c7be598b3e383855a2f7

Full URL: https://github.com/mbedmicro/mbed/commit/6663575abc7a56be6750c7be598b3e383855a2f7/

Changed in this revision

targets/hal/TARGET_Freescale/TARGET_K20D50M/pwmout_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_Freescale/TARGET_KLXX/pwmout_api.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/hal/TARGET_Freescale/TARGET_K20D50M/pwmout_api.c	Tue Jul 22 09:15:07 2014 +0100
+++ b/targets/hal/TARGET_Freescale/TARGET_K20D50M/pwmout_api.c	Wed Jul 23 08:45:10 2014 +0100
@@ -99,11 +99,11 @@
         value = 1.0;
     }
 
-    *obj->CnV = (uint32_t)((float)(*obj->MOD) * value);
+    *obj->CnV = (uint32_t)((float)(*obj->MOD + 1) * value);
 }
 
 float pwmout_read(pwmout_t* obj) {
-    float v = (float)(*obj->CnV) / (float)(*obj->MOD);
+    float v = (float)(*obj->CnV) / (float)(*obj->MOD + 1);
     return (v > 1.0) ? (1.0) : (v);
 }
 
@@ -118,7 +118,7 @@
 // Set the PWM period, keeping the duty cycle the same.
 void pwmout_period_us(pwmout_t* obj, int us) {
     float dc = pwmout_read(obj);
-    *obj->MOD = (uint32_t)(pwm_clock * (float)us);
+    *obj->MOD = (uint32_t)(pwm_clock * (float)us) - 1;
     pwmout_write(obj, dc);
 }
 
--- a/targets/hal/TARGET_Freescale/TARGET_KLXX/pwmout_api.c	Tue Jul 22 09:15:07 2014 +0100
+++ b/targets/hal/TARGET_Freescale/TARGET_KLXX/pwmout_api.c	Wed Jul 23 08:45:10 2014 +0100
@@ -78,12 +78,12 @@
         value = 1.0;
     }
 
-    *obj->CnV = (uint32_t)((float)(*obj->MOD) * value);
+    *obj->CnV = (uint32_t)((float)(*obj->MOD + 1) * value);
     *obj->CNT = 0;
 }
 
 float pwmout_read(pwmout_t* obj) {
-    float v = (float)(*obj->CnV) / (float)(*obj->MOD);
+    float v = (float)(*obj->CnV) / (float)(*obj->MOD + 1);
     return (v > 1.0) ? (1.0) : (v);
 }
 
@@ -98,7 +98,7 @@
 // Set the PWM period, keeping the duty cycle the same.
 void pwmout_period_us(pwmout_t* obj, int us) {
     float dc = pwmout_read(obj);
-    *obj->MOD = (uint32_t)(pwm_clock * (float)us);
+    *obj->MOD = (uint32_t)(pwm_clock * (float)us) - 1;
     pwmout_write(obj, dc);
 }