Crate ruspiro_gpio[][src]

Expand description

Raspberry Pi GPIO access abstraction

This crate provide as simple to use and safe abstraction of the GPIO’s available on the Raspberry Pi 3. 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 ruspiro_pi3 feature while compiling.

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 doc() {
    GPIO.with_mut(|gpio| {
        let pin = gpio.get_pin(17).unwrap(); // assuming we can always get this pin as it is not in use already
        pin.into_output().high(); // set this pin to high - this may lit a connected LED :)
    });
}

Features

  • ruspiro_pi3 Ensures the proper MMIO base memory address is used for Raspberry Pi 3

Modules

Unsafe GPIO access

Structs

GPIO peripheral representation

The error type that will be returned on issues with accessing the GPIO peripheral

Representation of a GPIO pin that can have specific features. Those features are described with generic arguments to define the pin e.g. as an output pin with disabled PullUp/Down.

Enums

The different GPIO detect events, an event handler can be registered for

Statics

Static Singleton accessor to the GPIO peripheral. The Singleton ensures cross core mutual exclusive access.

Functions

Implement interrupt handler for GPIO driven interrupts from bank 0 (GPIO 0..31)

Implement interrupt handler for GPIO driven interrupts from bank 1 (GPIO 32..53)