Struct capsules::gpio_async::GPIOAsync [] [src]

pub struct GPIOAsync<'a, Port: Port + 'a> {
    ports: &'a [&'a Port],
    callback: Cell<Option<Callback>>,
    interrupt_callback: Cell<Option<Callback>>,
}

Fields

Methods

impl<'a, Port: Port> GPIOAsync<'a, Port>
[src]

[src]

[src]

[src]

Trait Implementations

impl<'a, Port: Port> Client for GPIOAsync<'a, Port>
[src]

[src]

Called when an interrupt occurs. The pin that interrupted is included, and the identifier that was passed with the call to enable_interrupt is also returned. Read more

[src]

Done is called when a configuration command finishes.

impl<'a, Port: Port> Driver for GPIOAsync<'a, Port>
[src]

[src]

Setup callbacks for gpio_async events.

subscribe_num

  • 0: Setup a callback for when split-phase operations complete. This callback gets called from the gpio_async done() event and signals the end of operations like asserting a GPIO pin or configuring an interrupt pin. The callback will be called with two valid arguments. The first is the callback type, which is currently 0 for all done() events. The second is a value, which is only useful for operations which should return something, like a GPIO read.
  • 1: Setup a callback for when a GPIO interrupt occurs. This callback will be called with two arguments, the first being the port number of the interrupting pin, and the second being the pin number.

[src]

Configure and read GPIO pins.

pin is the index of the pin.

data is a 32 bit value packed with the lowest 16 bits as the port number, and the remaining upper bits as a command-specific value.

command_num

  • 0: Driver check and get number of GPIO ports supported.
  • 1: Set a pin as an output.
  • 2: Set a pin high by setting it to 1.
  • 3: Clear a pin by setting it to 0.
  • 4: Toggle a pin.
  • 5: Set a pin as an input and configure its pull-up or pull-down state. The command-specific field should be set to 0 for a pull-up, 1 for a pull-down, or 2 for neither.
  • 6: Read a GPIO pin state, and have its value returned in the done() callback.
  • 7: Enable an interrupt on a GPIO pin. The command-specific data should be 0 for an either-edge interrupt, 1 for a rising edge interrupt, and 2 for a falling edge interrupt.
  • 8: Disable an interrupt on a pin.
  • 9: Disable a GPIO 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