diff --git a/hal/api/PwmOut.h b/hal/api/PwmOut.h index cd9d833281c..86f40d6e5a8 100644 --- a/hal/api/PwmOut.h +++ b/hal/api/PwmOut.h @@ -67,6 +67,14 @@ class PwmOut { core_util_critical_section_exit(); } + /** To Free up pwm pin. + */ + ~PwmOut() { + core_util_critical_section_enter(); + pwmout_free(&_pwm); + core_util_critical_section_exit(); + } + /** Set the ouput duty-cycle, specified as a percentage (float) * * @param value A floating-point value representing the output duty-cycle,