denko-rb / lgpio

Ruby C extension for Linux GPIO
MIT License
7 stars 0 forks source link

FAQ? #1

Open rubyFeedback opened 6 days ago

rubyFeedback commented 6 days ago

Do you think a FAQ could be added to the project?

One question I have is whether there is a possibility for a GUI in regards to lgpio. Perhaps something like libui-ng, although that one focuses on gtk3 so it may be too much for small devices.

vickash commented 6 days ago

A Frequently Asked Questions section is a good idea, but this is literally the first question, so maybe in future?

Wrt a GUI, the purpose of this gem is to be the absolute minimum to make Linux GPIO accessible in Ruby. Nothing more. It won't ever do GUI anything. Also, to be clear, this is for Linux SBCs in the same class as the Raspberry Pi 1 or above, not anything smaller.

That said, if you want a GUI in a Ruby program, you can use the ruby2d gem for your GUI, together with lgpio for your GPIO access.

I would recommend you check out denko-piboard instead of lgpio though. It uses lgpio under the hood, but has more (opinionated) layers built on top: abstract away gpiochip/line, pwmchip/channel, soft/hard PWM, buses etc. Also, all the device driver work goes into the main denko gem, which makes them available in denko-piboard too, but not lgpio.

I didn't put the lgpio stuff directly in denko-piboard for a couple reasons:

vickash commented 5 days ago

@rubyFeedback, take a look at this example.

I've been meaning to try ruby2d for a while. It seems very straightforward to use. I imagine it's possible to run on a Raspberry Pi touchscreen or something similar. I haven't experimented with that yet, but would be fun to try out. Will add more examples if and when I do.

Also, the libui-ng library you mentioned is supported by the Glimmer DSL: https://github.com/AndyObtiva/glimmer-dsl-libui. You should be able to use that in combination with one of the denko gems, just as I've done with ruby2d in the above example.