WiringPi Bindings for Rust
An API wrapper for WiringPi to make it accessible using Rust. It implements the most important functions and provides a bit of type system convenience.
Add the following lines to your Cargo.io
to use rust-wiringpi
:
[]
= "0.2"
Online Documentation
Example: Flashing Light
extern crate wiringpi;
use ;
use ;
Cross Compiling Using Cargo
The following instructions are currently outdated, so don't follow them. See other guides or this comment for now.
This project can be cross compiled using Cargo.
Follow these instructions
And use ./cross64 build
or ./cross32 build
, depending on your system,
to check if everything builds as expected.
Orange Pi support
rust-wiringpi
can also wrap the WiringOP library for the Orange Pi SBC boards.
This can be enabled with the orangepi
feature:
[]
= "0.2"
= ["orangepi"]
Development Mode
In development mode, rust-wiringpi
is compiled as a rust-native library excluding the original WiringPi.
And binding functions are replaced by dummy functions that output simple logs to stdout.
With this mode, you can build and debug your project on platforms that does not support WiringPi.
# build
$ cargo build --features wiringpi/development
# run
$ cargo run --features wiringpi/development
[wiringpi] `wiringPiSetup` called
[wiringpi] `pinMode` called with: 0, 1
[wiringpi] `digitalWrite` called with: 0, 1
[wiringpi] `digitalWrite` called with: 0, 0
...