ronisbr / BaremetalPi.jl

Julia library to access Raspberry Pi peripherals without requiring external libraries.
Other
49 stars 5 forks source link

PWM #2

Open yakir12 opened 3 years ago

yakir12 commented 3 years ago

Feature request for the far future: add controls for PWM.

This is really just a place holder for a todo. Not an actual issue...

ronisbr commented 3 years ago

Ok! I agree, I really need to add this... The hardware PWM should be easy to configure. I am also thinking how can I use the multi-threading capabilities of Julia to also provide software PWM.

notinaboat commented 3 years ago

I was looking into the PWM capabilities of the Pi and found this reference from the pigpio doc about how the DMA peripheral is used to do "hardware timed PWM on any of GPIO 0-31": https://github.com/joan2937/pigpio/blob/cc17196c7586c3625ac8adf8f34838d320ffeda6/pigpio.h#L71-L73

This is a related part of the servoblaster docs: https://github.com/richardghirst/PiBits/blob/master/ServoBlaster/README.txt#L105-L112

ronisbr commented 3 years ago

I was looking into the PWM capabilities of the Pi and found this reference from the pigpio doc about how the DMA peripheral is used to do "hardware timed PWM on any of GPIO 0-31": https://github.com/joan2937/pigpio/blob/cc17196c7586c3625ac8adf8f34838d320ffeda6/pigpio.h#L71-L73

This is a related part of the servoblaster docs: https://github.com/richardghirst/PiBits/blob/master/ServoBlaster/README.txt#L105-L112

Thanks for the info! I will try to implement it as soon as possible!

metelkin commented 3 years ago

Vote for it!

ronisbr commented 3 years ago

Hi @metelkin

Yeah... I am in debt here. Sorry for the delay. The last months were insane here and I just had not time to come back to this project. However, it is not dead and I promise I will do this as soon as possible (if we can't find someone to do this).

metelkin commented 3 years ago

It's ok. I wish I could help but unfortunately, my skills are not enough for such "low-level" programming tasks.

notinaboat commented 3 years ago

@metelkin, in the meantime you may be able to use this wrapper:

https://github.com/notinaboat/PiGPIOC.jl

The PWM API functions are here: https://github.com/notinaboat/PiGPIOC.jl/blob/9052eaaa7bcffd634cdfd39fbc3280728dd9d1b4/src/pigpio.jl#L5-L7 https://github.com/notinaboat/PiGPIOC.jl/blob/9af37c6fff20ca963bfe0c5a3592f37925c300bf/src/pigpio.jl#L33-L57

The documentation is here: http://abyz.me.uk/rpi/pigpio/cif.html#gpioPWM

metelkin commented 3 years ago

@metelkin, in the meantime you may be able to use this wrapper:

https://github.com/notinaboat/PiGPIOC.jl

Thank you @notinaboat, interesting.