Api

Trait Api 

Source
pub trait Api: Support<usize> + Send {
    // Required methods
    fn configure(gpio: Id<Self>, config: Config) -> Result<(), Error>;
    fn read(gpio: Id<Self>) -> Result<bool, Error>;
    fn write(gpio: Id<Self>, value: bool) -> Result<(), Error>;
    fn last_write(gpio: Id<Self>) -> Result<bool, Error>;
    fn enable(gpio: Id<Self>, falling: bool, rising: bool) -> Result<(), Error>;
    fn disable(gpio: Id<Self>) -> Result<(), Error>;
}
Available on crate feature api-gpio only.
Expand description

Low-level GPIO interface.

Required Methods§

Source

fn configure(gpio: Id<Self>, config: Config) -> Result<(), Error>

Configures a GPIO.

Source

fn read(gpio: Id<Self>) -> Result<bool, Error>

Reads from a GPIO (must be configured as input).

Source

fn write(gpio: Id<Self>, value: bool) -> Result<(), Error>

Writes to a GPIO (must be configured as output).

Source

fn last_write(gpio: Id<Self>) -> Result<bool, Error>

Returns the last logical value written to a GPIO (must be configured as output).

Source

fn enable(gpio: Id<Self>, falling: bool, rising: bool) -> Result<(), Error>

Enables an event to be triggered on the given conditions (at least one must be true).

Source

fn disable(gpio: Id<Self>) -> Result<(), Error>

Disables an event from being triggered on all conditions.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§