Module capsules::button [] [src]

Provides userspace control of buttons on a board.

This allows for much more cross platform controlling of buttons without having to know which of the GPIO pins exposed across the syscall interface are buttons.

Usage

let button_pins = static_init!(
    [&'static sam4l::gpio::GPIOPin; 1],
    [&sam4l::gpio::PA[16]]);
let button = static_init!(
    capsules::button::Button<'static, sam4l::gpio::GPIOPin>,
    capsules::button::Button::new(button_pins, kernel::Grant::create()));
for btn in button_pins.iter() {
    btn.set_client(button);
}

Syscall Interface

Command

Enable or disable button interrupts and read the current button state.

command_num

Subscribe

Setup a callback for button presses.

subscribe_num

Reexports

use core::cell::Cell;
use kernel::AppId;
use kernel::Callback;
use kernel::Driver;
use kernel::Grant;
use kernel::ReturnCode;
use kernel::hil;
use kernel::hil::gpio::Client;
use kernel::hil::gpio::InterruptMode;

Structs

Button

Manages the list of GPIO pins that are connected to buttons and which apps are listening for interrupts from which buttons.

Enums

ButtonState

Values that are passed to userspace to identify if the button is pressed or not.

GpioMode

Whether the GPIOs for the buttons on this platform are low when the button is pressed or high.

Constants

DRIVER_NUM

Syscall driver number.

Type Definitions

SubscribeMap

This capsule keeps track for each app of which buttons it has a registered interrupt for. SubscribeMap is a bit array where bits are set to one if that app has an interrupt registered for that button.