Module capsules::gpio [] [src]

Provides userspace applications with access to GPIO pins.

GPIOs are presented through a driver interface with synchronous commands and a callback for interrupts.

This capsule takes an array of pins to expose as generic GPIOs. Note that this capsule is used for general purpose GPIOs. Pins that are attached to LEDs or buttons are generally wired directly to those capsules, not through this capsule as an intermediary.

Usage

let gpio_pins = static_init!(
    [&'static sam4l::gpio::GPIOPin; 4],
    [&sam4l::gpio::PB[14],
     &sam4l::gpio::PB[15],
     &sam4l::gpio::PB[11],
     &sam4l::gpio::PB[12]]);
let gpio = static_init!(
    capsules::gpio::GPIO<'static, sam4l::gpio::GPIOPin>,
    capsules::gpio::GPIO::new(gpio_pins));
for pin in gpio_pins.iter() {
    pin.set_client(gpio);
}

Syscall Interface

Commands

All GPIO operations are synchronous.

Commands control and query GPIO information, namely how many GPIOs are present, the GPIO direction and state, and whether they should interrupt.

Subscribes

The GPIO interface provides only one callback, which is used for pins that have had interrupts enabled.

Reexports

use core::cell::Cell;
use kernel::AppId;
use kernel::Callback;
use kernel::Driver;
use kernel::ReturnCode;
use kernel::hil::gpio::Client;
use kernel::hil::gpio::InputMode;
use kernel::hil::gpio::InterruptMode;
use kernel::hil::gpio::Pin;
use kernel::hil::gpio::PinCtl;

Structs

GPIO

Constants

DRIVER_NUM

Syscall driver number.