Trait kernel::hil::gpio_async::Port [] [src]

pub trait Port {
    fn disable(&self, pin: usize) -> ReturnCode;
fn make_output(&self, pin: usize) -> ReturnCode;
fn make_input(&self, pin: usize, mode: InputMode) -> ReturnCode;
fn read(&self, pin: usize) -> ReturnCode;
fn toggle(&self, pin: usize) -> ReturnCode;
fn set(&self, pin: usize) -> ReturnCode;
fn clear(&self, pin: usize) -> ReturnCode;
fn enable_interrupt(
        &self,
        pin: usize,
        mode: InterruptMode,
        identifier: usize
    ) -> ReturnCode;
fn disable_interrupt(&self, pin: usize) -> ReturnCode; }

Interface for banks of asynchronous GPIO pins. GPIO pins are asynchronous when there is an asynchronous interface used to control them. The most common example is when using a GPIO extender on an I2C or SPI bus. With asynchronous GPIO functions, every config action results in an eventual callback function that indicates that the configuration has finished (unless the initial function call returns an error code, then no callback will be generated).

Asynchronous GPIO pins are grouped into ports because it is assumed that the remote entity that is controlling the pins can control multiple pins. Typically, a port will be provided by a particular driver.

The API for the Port mirrors the synchronous GPIO interface.

Required Methods

Try to disable a GPIO pin. This cannot be supported for all devices.

Configure a pin as an ouput GPIO.

Configure a pin as an input GPIO. Not all InputMode settings may be supported by a given device.

Get the state (0 or 1) of an input pin. The value will be returned via a callback.

Toggle an output GPIO pin.

Assert a GPIO pin high.

Clear a GPIO pin low.

Setup an interrupt on a GPIO input pin. The identifier should be the port number and will be returned when the interrupt callback fires.

Disable an interrupt on a GPIO input pin.

Implementors