C++ Development Headers for DIO Pin State Updates?

Topics about the Hardware of Revolution Pi
Post Reply
Niels Slotboom
Posts: 3
Joined: 22 Jul 2025, 12:53

C++ Development Headers for DIO Pin State Updates?

Post by Niels Slotboom »

I’m currently developing a C++ application that needs to control the output pin states of a RevPi DIO module connected to a RevPi Connect 5. The program runs directly on the RevPi Connect 5 under **Bookworm** (Debian GNU/Linux, kernel `6.6.0-revpi8-rpi-v8`).

Ideally, I’d like to use the symbolic pin names defined in the PiCtory process image (e.g. `"O_1"`) directly in my C++ code to set pin states. From the available documentation and prior discussions (including some with ChatGPT), this appears to be supported via the **`revpi-dev`** package, which provides headers such as `piControlIf.h` and the corresponding shared library (`libpiControl.so`).

However, I’ve been unable to locate `revpi-dev` (or any alternative development package providing those headers) in the Bookworm repositories. Could you advise on:

* How to obtain the necessary headers and libraries for **Bookworm**?
* Whether there is a **newer/recommended API** for accessing named pins in C++ on recent RevPi systems?

As a temporary workaround, I’m using:

```cpp
std::string cmd = "piTest -w " + identifier + "," + (state ? "1" : "0") + " > /dev/null 2>&1";
std::system(cmd.c_str());
```

—but this relies on `std::system`, which spawns a shell process for every call and is not ideal for production use.

Any official guidance or workarounds would be greatly appreciated!
User avatar
nicolaiB
KUNBUS
Posts: 1131
Joined: 21 Jun 2018, 10:33
Location: Berlin
Contact:

Re: C++ Development Headers for DIO Pin State Updates?

Post by nicolaiB »

Hi,

unfortunately that's made up by chatpt: there is no such thing like revpi-dev or libpiControl.so. Nevertheless you can find a C example of how to access the process image here https://gitlab.com/revolutionpi/revpi-pitest/ (should be relatively easy to transfer this to c++. It also includes the header file you have mentioned: https://gitlab.com/revolutionpi/revpi-p ... type=heads

Nicolai
Nicolai
Niels Slotboom
Posts: 3
Joined: 22 Jul 2025, 12:53

Re: C++ Development Headers for DIO Pin State Updates?

Post by Niels Slotboom »

Thank you for your response. Am I correct in my understanding that the repository you linked is the source for the `piTest` command on the RevPi?

Further, would I need to simply copy the files `piControlIf.c` and `piControlIf.h` into my project, and then use the functions they expose to update pin states?
User avatar
nicolaiB
KUNBUS
Posts: 1131
Joined: 21 Jun 2018, 10:33
Location: Berlin
Contact:

Re: C++ Development Headers for DIO Pin State Updates?

Post by nicolaiB »

Yes, this is the source code of the piTest application on your RevPi. The includes can be re-used for your application too. In the piTest source you can have a look which functions / how it does work.
Nicolai
Niels Slotboom
Posts: 3
Joined: 22 Jul 2025, 12:53

Re: C++ Development Headers for DIO Pin State Updates?

Post by Niels Slotboom »

Thank you, I have now managed to integrate this into my application.
Post Reply