Trait Gpio

Source
pub trait Gpio {
    // Required methods
    fn init(&mut self, port: i32, pin: i32, output: bool) -> Result<i32, Error>;
    fn deinit(&mut self, handle: i32) -> Result<(), Error>;
    fn set(&mut self, handle: i32, state: PinState) -> Result<(), Error>;
    fn get(&mut self, handle: i32) -> Result<PinState, Error>;
}
Expand description

Platform GPIO API abstraction.

This hides runtime implementation details to simplify implementing GPIO contexts. Hopefully one day generation is improved so we don’t need this any more

Required Methods§

Source

fn init(&mut self, port: i32, pin: i32, output: bool) -> Result<i32, Error>

Initialise a GPIO by port and pin, returning a handle

Source

fn deinit(&mut self, handle: i32) -> Result<(), Error>

Deinitialise a GPIO by handle

Source

fn set(&mut self, handle: i32, state: PinState) -> Result<(), Error>

Set a GPIO state by handle

Source

fn get(&mut self, handle: i32) -> Result<PinState, Error>

Fetch a GPIO state by handle

Implementors§