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§
Sourcefn read(gpio: Id<Self>) -> Result<bool, Error>
fn read(gpio: Id<Self>) -> Result<bool, Error>
Reads from a GPIO (must be configured as input).
Sourcefn write(gpio: Id<Self>, value: bool) -> Result<(), Error>
fn write(gpio: Id<Self>, value: bool) -> Result<(), Error>
Writes to a GPIO (must be configured as output).
Sourcefn last_write(gpio: Id<Self>) -> Result<bool, Error>
fn last_write(gpio: Id<Self>) -> Result<bool, Error>
Returns the last logical value written to a GPIO (must be configured as output).
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.