This package helps you to develop software for the RaspberryPi that does IO operations on the RaspberryPi. It enables you to develop your code locally on any type of architecture, by using gRPC to control a Raspberry PI remotely. This is very convenient in conjunction with services like balena.io.
This makes developing applications for the RaspberryPi extremely easy. Once your software is ready, you have the option of continuing to use gRPC calls, or switch over to a local version of the interfaces to compile a binary that runs directly on the RaspberryPi.
If you have any suggestion or comments, please feel free to open an issue on this GitHub page.
Read the go docs to to see usage. For more concrete examples see rpi-client code.
There are 2 ways of installing the binaries:
- Download the binaries latest release
- Install from source:
go get github.com/gbbirkisson/rpi
Take a look at the rpi-balena project to see how to use balena.io
Both server and client can be configured with:
- Flags
- Environment
- Configuration file
The presidence is in that order, i.e flags override environment that overrides the configuration file.
Use -h
flag to see available flags for rpi-client
and rpi-server
.
Configuration files can be in the following formats:
- json
- toml
- yaml
- hcl
Locations of those files are:
- Server:
/etc/rpi-server/config.[format]
- Client:
~/.rpi-client.[format]
To generate the default configuration files (yaml in this example) do:
# For server
$ touch /etc/rpi-server/config.yaml
$ rpi-server config write
# For client (linux/mac)
$ touch ~/.rpi-client.yaml
$ rpi-client config write
# For client (windows)
$ type nul > %userprofile%\.rpi-client.yaml
$ rpi-client.exe config write
The resulting client configuration file (~/.rpi-client.yaml
) would be something like:
server:
host: 127.0.0.1
port: 8000
timeout: 5000
picam:
viewer:
- feh
- -x
- '-'
Environmental variables mirror the configuration files. All variables have the prefix RPI_
. So for example if you want to set the client timeout you can set it with the environment variable RPI_SERVER_TIMEOUT=3000
Generate a client for your language of choice with protoc
using ./pkg/proto/*.proto files.