Skip to content
Snippets Groups Projects

[CountedPWM] Now driver handles the corner case of pulseFrequency equal to zero

Merged Emilio Corigliano requested to merge countedpwm-fix into main
@@ -56,6 +56,10 @@ CountedPWM::~CountedPWM()
void CountedPWM::setFrequency(unsigned int pulseFrequency)
{
this->pulseFrequency = pulseFrequency;
if (pulseFrequency == 0)
return;
pulseTimer.setFrequency(pulseFrequency * dutyCycleResolution);
pulseTimer.setAutoReloadRegister(
TimerUtils::getFrequency(pulseTimer.getTimer()) / pulseFrequency);
Loading