Wallacoloo / printipi

3d printing directly through the Raspberry Pi's GPIO pins
MIT License
141 stars 43 forks source link

IoPin should have a `pwmWrite()` method #76

Closed Wallacoloo closed 9 years ago

Wallacoloo commented 9 years ago

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.