mirror of https://github.com/ARMmbed/mbed-os.git
Fixed issue with PWM not being freed when the object is destroyed
parent
401a3c8551
commit
51a47139f3
|
@ -68,6 +68,7 @@ public:
|
||||||
~PwmOut()
|
~PwmOut()
|
||||||
{
|
{
|
||||||
core_util_critical_section_enter();
|
core_util_critical_section_enter();
|
||||||
|
pwmout_free(&_pwm);
|
||||||
unlock_deep_sleep();
|
unlock_deep_sleep();
|
||||||
core_util_critical_section_exit();
|
core_util_critical_section_exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,9 +235,13 @@ void pwmout_init(pwmout_t *obj, PinName pin)
|
||||||
|
|
||||||
void pwmout_free(pwmout_t *obj)
|
void pwmout_free(pwmout_t *obj)
|
||||||
{
|
{
|
||||||
/* Does nothing because it is not called in the MBED PWMOUT driver
|
#if DEVICE_SLEEP && DEVICE_LPTICKER
|
||||||
* destructor. The pwmout_init handles multiple calls of constructor.
|
if (!Cy_SysPm_UnregisterCallback(&obj->pm_callback_handler)) {
|
||||||
*/
|
error("PM callback unregistration failed!");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Cy_TCPWM_PWM_Disable(obj->base, obj->counter_id);
|
||||||
|
Cy_TCPWM_PWM_DeInit(obj->base, obj->counter_id, &pwm_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pwmout_write(pwmout_t *obj, float percent)
|
void pwmout_write(pwmout_t *obj, float percent)
|
||||||
|
|
Loading…
Reference in New Issue