Best approach Raspberry Pi 5?

Should be 2 more examples also in that first version.

One of them will list all the lines and their names and such.

In the upcoming version, I have entered a bit the deep waters…as in there are parts of libgpiod that are terrible fit for Xojo due to Xojo’s lack of real threads.

But I have in the upcoming version solved one such case where it can monitor Line Info async in native thread.

(Need to apply same solution for async reading of the Line values but those might not be there until 3rd phase, and the line values I will have little chance to test since I am 100 km away from the Raspberry and so far all my tests have been by remoting into it. I imagine to test async line value monitoring then we will actually have to set it like board with button on some pin and do it physically)

But i will release 2nd phase in this week where it should add enough to pass 3 more official examples, making the examples passed go to 6.

I put out massive update, and moved the updates for the plugin to my own thread to not permanently hijack this thread.

I posted here:

2 Likes

Nice work! I will test it today

I believe you can just make a commercial plugin wrapper for this:
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/
top line states: SPDX-License-Identifier: CC-BY-SA-4.0
Which is a creative commons license that seems to allow commercial use.

We will most likely benefit the most if this is maintained as stable as it gets.
This is ofcourse just a side node, not a requirement.

Nah its fine, I felt this one was good candidate for open source, it helps then new Plugin makers as they get source code to look at.

Bob’s Math plugins that I been attempting to maintain are not good place for new plugin author to look as things there are not done in ideal way and there will be long time until I get any grip there on just basic memory fault. So getting fresh plugin from scratch with this complexity level out in the community is good I think.

(And all my Plugins have always been free on Linux anyhow).

4 Likes

If I am understanding this article correctly:

https://medium.com/geekculture/raspberry-pi-c-libraries-for-working-with-i2c-spi-and-uart-4677f401b584

Then we will eventually need another plugin of some sort to cover I2C and then another for SPI.

libgpiod only covers GPIO as far as I am understanding it.

I have written a wrapper for Xojo and the libgpiod library and have been using the GPIO pins for about 4 years. It works will all Raspberry Pi’s and works on the latest Raspberry Pi 5.

Eugene’s free lgpio GPIO GitHub

I have written quite a few articles (about 7 so far and more to be published) in the xDev magazine which use the latest version of the libgpoid. Examples include I2C, SPI, and many other examples. More sensor and output examples will be published in future xDev magazine publications.

This library has been used by me for the last 4 years or so, and no issues so far. I am not sure how it works with Orange Pi or other variants.

//Initialize the Raspberry Pi lgpio
MyChipHandle = lgGpiochipOpen(4) //dev/gpiochip4 for Raspberry Pi 5
//MyChipHandle = lgGpiochipOpen(0) //dev/gpiochip0 for Raspberry Pi 4 or older

Raspberry Pi 5 has a different chipset, so the lgGPiochipOpen command handle function is to be set to 4, whereas earlier Raspberry Pi versions than 4 are set to zero.

I hope this helps.

Eugene

2 Likes

I think you are confusing though libgpiod and lgpio ?, looks like yours is using lgpio.

Those are two very different libraries.

1 Like