andrewdavidmackenzie / pigg

Raspberry Pi GPIO GUI
Apache License 2.0
75 stars 4 forks source link

GH Action codecov

pigg - Raspberry Pi GPIO GUI

An app for Raspberry Pi GPIO Output control and Input visualization, built in rust using the Iced GUI toolkit and rppal GPIO crate.

The GUI binary (Pi Gpio GUI - PIGGUI) is affectionately known as "piggy".

BCM Pin Layout Screenshot Board Pin Layout Screenshot

Board Pin Layout Screenshot

Currently, when run on a Pi, you can configure the Pi's GPIO hardware Inputs or Outputs, controlling the level of the Outputs and view the level of the Inputs.

It runs on macOS/Linux/Windows. When we add networking support, this will allow you to control the Pi GPIO hardware remotely.

Input Output

Current Features

You can see more gifs and videos of features here

Input from Raspberry Pi users wanted

We would like input from Raspberry Pi users to help us decide the order of things to work on in the future, and input on how integrate new functionalities (e.g. I2C buses, SPI, UART, etc.).

Please let us know what you think, and suggestions, via GitHub discussions or GH issues, or in threads where we communicate its existence (discord, reddit, etc.).

Short-term Roadmap

We have identified a number of areas we would like to work on after this initial release, but would really appreciate your input on what could be most useful or just the coolest, many have GH issues.

Further out ideas

Project Structure

PIGGUI ("Piggy")

A binary that shows a GUI for configuring pins, observing input levels and controlling output levels. On Raspberry Pi it has a real GPIO hardware backend (via rppal). On macOS, linux and windows it uses a fake GPIO hardware backend.

PIGLET ("Piglet)

A "GUI-less" binary. Currently, it has minimal functionality. It can be built on any platform and will use the fake Hardware backend (but not be very useful!).

If built on the Pi (with the "pi_hw" feature), then it has a real GPIO hardware backend.

It takes a file command line option. It will load the GPIO configuration from the file (like "piggui" can) and it will apply it to the hardware. But currently there is no way to interact with it after that.

Installing

macOS/linux/Windows or Pi (with a fake Hardware backend)

cargo install pigg

NOTE: cargo will build for the machine where you are running it, so you will get a version of piggui with a fake hardware backend, not real Pi GPIO hardware, but you can play with the GUI.

On Pi with real GPIO hardware backend

To be able to interact with real Pi GPIO hardware you have two options:

Soon, we will add support for cargo binstall to allow you to get a binary for Pi directly.

Building from Source

Pre-requisites

We use "cross" to cross compile for Raspberry Pi from Linux or macOS or Windows. None of the developers currently has a Windows machine, so we have been unable to test this on Windows. Install docker or podman and "cross" for cross compiling rust on your host for the Raspberry Pi.

If you run "make" on a Raspberry Pi, it will not use "cross" and just compile natively. So, to be clear "cross" is not a pre-requisite for Raspberry Pi native building.

Building on host development machine

Run "make" on macOS, linux, Windows (or in fact RPi also) host to build these binaries:

Use "make run" to start piggui on the local machine - for GUI development.

Building for Pi from macOS, linux or Windows

If you use make that builds for local host AND pi (using cross).

If you get strange build errors from cross, check first that your Docker daemon is running.

Helper Env vars

There are a couple of env vars that can be setup to help you interact with your pi.

You can set these up in your env, so you always have them, or set them on the command line when invoking make

Make targets

Building for Pi on a Pi!

You should be able to use make or make run directly, and it will build piggui with a GUI and also build piglet

Running

Piggui

Use make run

One macOS/linux/Windows this will build for the local machine, and start piggui with a fake hardware backend.

If you run that on a Raspberry Pi, it will detect that, and build for the Pi, with the real Pi GPIO hardware backend.

Piggui takes an optional filename argument, to attempt to load the code from. If there is an error loading a config, the default config will be used.

To do this you can use the equivalent of what make run does, adding the filename:

Contributing

See CONTRIBUTING.md

License

See LICENSE

Code of Conduct

See CODE_OF_CONDUCT.md

Security

See SECURITY.md