mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
Diff: targets/TARGET_NUVOTON/TARGET_NUC472/pwmout_api.c
- Revision:
- 161:2cc1468da177
- Parent:
- 149:156823d33999
--- a/targets/TARGET_NUVOTON/TARGET_NUC472/pwmout_api.c Tue Mar 14 16:40:56 2017 +0000 +++ b/targets/TARGET_NUVOTON/TARGET_NUC472/pwmout_api.c Thu Mar 30 13:45:57 2017 +0100 @@ -105,9 +105,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) @@ -143,9 +145,11 @@ } } - // 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)