Module capsules_core::gpio

source ·
Expand description

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.


let gpio_pins = static_init!(
    [Option<&'static sam4l::gpio::GPIOPin>; 4],
let gpio = static_init!(
    capsules::gpio::GPIO<'static, sam4l::gpio::GPIOPin>,
for maybe_pin in gpio_pins.iter() {
    if let Some(pin) = maybe_pin {

§Syscall Interface

  • Stability: 2 - Stable


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.


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