RPPAL - Raspberry Pi Peripheral Access Library
RPPAL is a Rust library that provides access to the Raspberry Pi GPIO peripheral through either /dev/gpiomem
or /dev/mem
. Support for additional peripherals, as well as useful helper functions, will be added in future updates. The library is compatible with the BCM2835, BCM2836 and BCM2837 SoCs.
Backwards compatibility for minor revisions isn't guaranteed until the library reaches v1.0.0.
Documentation
All documentation can be found at doc.golemparts.com/rppal.
Usage
Add a dependency for rppal
to your Cargo.toml
.
[]
= "0.1"
Link and import rppal
from your crate root.
extern crate rppal;
Call GPIO::new()
to create a new GPIO with the default settings. In production code, you'll want to parse the result rather than unwrap it.
use gpio;
let mut gpio = GPIO new.unwrap;
Example
extern crate rppal;
use thread;
use Duration;
use ;
use DeviceInfo;
// The GPIO module uses BCM pin numbering. BCM 18 equates to physical pin 12.
const GPIO_LED: u8 = 18;
Warning
Always be careful when working with the Raspberry Pi's GPIO. Improper use can lead to permanent damage to the Pi or external components.
Copyright and license
Copyright (c) 2017 Rene van der Meer. Released under the MIT license.