Struct capsules::gpio::GPIO [] [src]

pub struct GPIO<'a, G: Pin + 'a> {
    pins: &'a [&'a G],
    callback: Cell<Option<Callback>>,
}

Fields

Methods

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

[src]

[src]

[src]

Trait Implementations

impl<'a, G: Pin> Client for GPIO<'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

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

[src]

Subscribe to GPIO pin events.

subscribe_num

  • 0: Subscribe to interrupts from all pins with interrupts enabled. The callback signature is fn(pin_num: usize, pin_state: bool)

[src]

Query and control pin values and states.

Each byte of the data argument is treated as its own field. For all commands, the lowest order halfword is the pin number (pin). A few commands use higher order bytes for purposes documented below. If the higher order bytes are not used, they must be set to 0.

Other data bytes:

  • pin_config: An internal resistor setting. Set to 0 for a pull-up resistor. Set to 1 for a pull-down resistor. Set to 2 for none.
  • irq_config: Interrupt configuration setting. Set to 0 to interrupt on either edge. Set to 1 for rising edge. Set to 2 for falling edge.

command_num

  • 0: Number of pins.
  • 1: Enable output on pin.
  • 2: Set pin.
  • 3: Clear pin.
  • 4: Toggle pin.
  • 5: Enable input on pin with pin_config in 0x00XX00000
  • 6: Read pin value.
  • 7: Configure interrupt on pin with irq_config in 0x00XX00000
  • 8: Disable interrupt on pin.
  • 9: Disable pin.

[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