mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
161:2cc1468da177
Parent:
149:156823d33999
Child:
165:e614a9f1c9e2
--- a/targets/TARGET_NUVOTON/TARGET_M451/pwmout_api.c	Tue Mar 14 16:40:56 2017 +0000
+++ b/targets/TARGET_NUVOTON/TARGET_M451/pwmout_api.c	Thu Mar 30 13:45:57 2017 +0100
@@ -99,9 +99,11 @@
     
     ((struct nu_pwm_var *) modinit->var)->en_msk |= 1 << chn;
     
-    // Mark this module to be inited.
-    int i = modinit - pwm_modinit_tab;
-    pwm_modinit_mask |= 1 << i;
+    if (((struct nu_pwm_var *) modinit->var)->en_msk) {
+        // Mark this module to be inited.
+        int i = modinit - pwm_modinit_tab;
+        pwm_modinit_mask |= 1 << i;
+    }
 }
 
 void pwmout_free(pwmout_t* obj)
@@ -120,9 +122,11 @@
         CLK_DisableModuleClock(modinit->clkidx);
     }
     
-    // Mark this module to be deinited.
-    int i = modinit - pwm_modinit_tab;
-    pwm_modinit_mask &= ~(1 << i);
+    if (((struct nu_pwm_var *) modinit->var)->en_msk == 0) {
+        // Mark this module to be deinited.
+        int i = modinit - pwm_modinit_tab;
+        pwm_modinit_mask &= ~(1 << i);
+    }
 }
 
 void pwmout_write(pwmout_t* obj, float value)