Wallacoloo/printipi

IoPin should have a `pwmWrite()` method

Closed this issue · 0 comments

Right now, digital writes are implemented via IoPin.digitalWrite(), but setting a pin's PWM value is done by making a call to the HardwareScheduler.queuePwm(). This makes sense, because hardware PWM is not always possible. But it makes it necessary to pass a reference to the HardwareScheduler to any function that might need to use PWM, which is both impractical and awkward.

So, it would make more sense to implement IoPin.pwmWrite() and have it relay to PrimitiveIoPin.pwmWrite(), which can either implement it directly, or the developer can give their platform's HardwareScheduler a static method for scheduling pwm & use that.