I’m planning on a little hobby project, running on Linux on a SBC with GPIO. My idea is to generate PWM output on GPIO pins, and allow each pin to be available as a file in /dev, in the same way that the GPIO pins are. I would like to be able use the PWM device in the same way that the GPIO would work.
So I think I want to write a device driver, it seems to fit the bill.
The only hitch is that since I will be accessing the pins through /dev/GPIO, my program can exist in user space. And ‘can exist in user space’ usually implies ‘should exist in userspace’.
I’m sure this could be written as a user-space daemon or a kernel-space device driver, or something else.
What’s the best thing to do?
It depends on the built-in features of the microcontroller on your SBC. If you are sure there is no PWM block already established in its architecture then I guess you would need to convert a GPIO pin to do this.
This project may be of interest.