Struct capsules::button::Button [] [src]

pub struct Button<'a, G: Pin + 'a> {
    pins: &'a [(&'a G, GpioMode)],
    apps: Grant<(Option<Callback>, SubscribeMap)>,
}

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

Fields

Methods

impl<'a, G: Pin + PinCtl> Button<'a, G>
[src]

[src]

[src]

Trait Implementations

impl<'a, G: Pin + PinCtl> Driver for Button<'a, G>
[src]

[src]

Set callbacks.

subscribe_num

  • 0: Set callback for pin interrupts. Note setting this callback has no reliance on individual pins being configured as interrupts. The interrupt will be called with two parameters: the index of the button that triggered the interrupt and the pressed/not pressed state of the button.

[src]

Configure interrupts and read state for buttons.

data is the index of the button in the button array as passed to Button::new().

All commands greater than zero return EINVAL if an invalid button number is passed in.

command_num

  • 0: Driver check and get number of buttons on the board.
  • 1: Enable interrupts for a given button. This will enable both press and depress events.
  • 2: Disable interrupts for a button. No affect or reliance on registered callback.
  • 3: Read the current state of the button.

[src]

allow lets an application give the driver access to a buffer in the application's memory. This returns ENOSUPPORT if not used. Read more

impl<'a, G: Pin + PinCtl> Client for Button<'a, G>
[src]

[src]

Called when an interrupt occurs. The identifier will be the same value that was passed to enable_interrupt() when the interrupt was configured. Read more