Closed nekuz0r closed 9 years ago
Hello,
DO NOT MERGE IT RIGHT NOW !
I created this pull request to get your opinion. I still have some modifications to make.
Can you please review the code ? :)
Wow! What a huge update! I've had a look through and it's looking pretty good to me. I'm actually on a business trip at the moment, so time is a bit of a premium. Happy for you once you've stabilised the bill to push it out and then to address any fixes as minor version fixes.
Well done, this is great work!
Merry christmas everyone, I need some more time to check everything is ok with this version, it should be promoted to master in the next weeks.
Great! I'm waiting for that!
woo! can't wait!
NOTE: Each “cycle” of PWM output takes 10mS with the default range value of 100, so trying to change the PWM value more than 100 times a second will be futile.
So 100 Hz is the limit? In this blog post wiringPi binding for Python is able to hit 20 kHz. Where is the gap?
There are some limitations… To maintain a low CPU usage, the minimum pulse width is 100μS. That combined with the default suggested range of 100 gives a PWM frequency of 100Hz. You can lower the range to get a higher frequency, at the expense of resolution, or increase to get more resolution, but that will lower the frequency. If you change the pulse-width in the driver code, then be aware that at delays of less than 100μS wiringPi does it in a software loop, which means that CPU usage will rise dramatically, and controlling more than one pin will be almost impossible.
Source: http://wiringpi.com/reference/software-pwm-library/
The blog example you are referring to is using a soft loop to switch the pin state as fast as possible.
RPI has a hardware pwm on pin 1 (BMC_GPIO 18, Phys 12). You can control it with the following functions :
Generating a PWM signal on any other pin requires to do it in software, then you will use :
softPwmCreate takes as third argument the range.
Hope this answers your question :)
Thanks for the explanation ;)
Great job on landing this @nekuz0r ! Woo!
v2.0.0
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r
nekuz0r