[][src]Crate ruspiro_gpio

Raspberry Pi GPIO access abstraction

Implementation of a simple and safe API to access Raspberry Pi3 GPIO's. The GPIO configuration requires access to MMIO registers with a specific memory base address. As this might differ between different models the right address is choosen based on the given target_family while compiling. The value needed for a Raspberry Pi 3 is ruspiro-pi3.

Usage

The crate provides a singleton accessor to the GPIO peripheral and it's pin to be used in a safe manner like this:

use ruspiro_gpio::GPIO;
 
fn demo() {
    GPIO.take_for(|gpio| {
        let pin = gpio.get_pin(17).unwrap(); // assuming we can always get this pin as it is not in use already
        pin.to_output().high(); // set this pin to high - this may lit a connected LED :)
    });
}

Re-exports

pub use self::pin::*;

Modules

pin

Definition of GPIO Pins

Structs

Gpio

GPIO peripheral representation

Statics

GPIO

Static "singleton" accessor to the GPIO peripheral