Description
The HAL of the mbed SDK defines a pwmout_free
function that needs to be implemented by the targets. However, the PwmOut
class that uses the HAL does not use this function anywhere.
The de facto LPC176X
target doesn't do anything in it's pwmout_free
implementation, but e.g Silicon Lab's EFM32
targets requires the function to be called to enable the improved mbed sleep API. This means on EFM32 MCUs the sleep
function won't make the MCU go to a low power mode when a PWMOut object is used, even when it has been freed.
This issue has also been mentioned in a comment to issue #1409.
Expected
The PwmOut
class should call pwmout_free
in it's descriptor, i.e:
~PwmOut() {
pwmout_free(&_pwm);
}
or provide some other way to disable the PWM channel and low power sleep.
Actual behavior
The pwmout_free
is not used by the mbed SDK used. Why then does this function exist?