Forum > General

Accessing GPIO signals on RaspberryPi using PiGpio?

(1/1)

BosseB:
I am building a simple rain meter which uses a reed switch on a rain collection device to register a certain amount of water received. The reed switch momentarily closes when the container is emptied.
It will be connected between 0V and a GPIO pin, which will have a 4K7 pull-up to 3.3V so that on activation there is a low level pulse which needs to be detected.

About 8 years ago or so I used the PiGpio unit to handle the read/write of GPIO pins on the RPi and it worked OK. But since then I have not dealt with the GPIO pins much...

The RPi has evolved from then and now I am not sure what to use in order to do the I/O stuff...
Newer RPi devices use different hardware and 64 bit operating system etc...

So what is the state of the PiGpio unit now?

Can it be used with RPi devices like RPi2, RPi3, RPi4, RPi5, RPiZero-W?
And does it work with PiOS both 32 and 64 bit?

I do not want to use anything like Python etc, just Pascal and Lazarus as dev tool.

EDIT

Question:
Is there a way to define some kind of interrupt that fires when the input pin changes state?
It seems like a waste to loop reading the port to see the high-to-low transition...

Thaddy:
The only difference between the different Raspberry Pi devices is the offset of the pin array.
But that is documented by the Raspberry Pi foundation. So the code in the wiki  simply works if you replace the address start with the one for your version.
That is really all. Apart from the start address all code is compatible.

BosseB:

--- Quote from: Thaddy on June 06, 2024, 03:26:31 pm ---The only difference between the different Raspberry Pi devices is the offset of the pin array.
But that is documented by the Raspberry Pi foundation. So the code in the wiki  simply works if you replace the address start with the one for your version.
That is really all. Apart from the start address all code is compatible.

--- End quote ---

Ok, but I am not used to digging low into drivers and such...

Is there no simplified version of PiGpio or wrapper for it which can be used ONLY to read and write the state of the GPIO pins?
By limiting the usage to only read and write of the GPIO pins by header pin number or GPIO number as published and nothing else it would become much easier to use than figuring out the inner workings of the library...

I think I am not alone in wanting to do just that for reading digital data and activating some output response.

I tried to go into it from what is written in the Wiki page but failed to actually understanding what needs to be done.

My current project is dead simple and will run on a PiZero-W using two GPIO pins on the header, one input and one output.

Thaddy:
It is now a bit late, but I can post most of them later tomorrow.
OTOH, you can simply find them in the Raspberry Pi docs, same source where I got them.

Navigation

[0] Message Index

Go to full version