Library that allows for higher resolution and speed than standard mbed PWM library using same syntax (drop-in replacement).

Dependents:   PwmOscillator FastStepDriver TLC5940 CameraTest ... more

Issue: check if duty is < 0 or > 1

void FastPWM::write(double duty) {
    _duty=duty;
    pulsewidth_ticks(duty*getPeriod());
}

I think this (and maybe pulsewidth functions too) should check for values as to remain in the 0.0 - 1.0 range

And a BIG THANKS man!

1 comment:

09 Jan 2015

Hey,

In general the goal of FastPWM is besides to have increased resolution, to also have good performance. So not always there will be checks and instead it is a job for the user to use the correct values.

That said, this function isn't exactly time critical, since a double multiplication isn't fast anyway, so a comparison shouldn't be much overhead. I will add it soonish :). Or alternatively, you are also welcome to make a pull request :D.

Thanks.

Erik