Struct tokio_gpiod::Options

source ·
pub struct Options<Direction = (), Lines = (), Consumer = ()> { /* private fields */ }
Expand description

GPIO line values request options

Input config:

let input = Options::input(&[23, 17, 3])
    .active(Active::Low)
    .bias(Bias::PullUp)
    .consumer("my inputs");

Output config:

let output = Options::output(&[11, 20])
    .active(Active::Low)
    .drive(Drive::PushPull)
    .values([false, true])
    .consumer("my outputs");

Input with edge detection:

let input = Options::input(&[21, 13])
    .active(Active::Low)
    .bias(Bias::PullUp)
    .edge(EdgeDetect::Both)
    .consumer("my inputs");

Implementations§

source§

impl Options

source

pub fn input<Lines>(lines: Lines) -> Options<Input, Lines, &'static str>
where Lines: AsRef<[u32]>,

Create input options

source

pub fn output<Lines>(lines: Lines) -> Options<Output, Lines, &'static str>
where Lines: AsRef<[u32]>,

Create output options

source§

impl<Direction, Lines, OldConsumer> Options<Direction, Lines, OldConsumer>

source

pub fn consumer<Consumer>( self, consumer: Consumer ) -> Options<Direction, Lines, Consumer>
where Consumer: AsRef<str>,

Configure consumer string

source§

impl<Direction, Lines, Consumer> Options<Direction, Lines, Consumer>

source

pub fn active(self, active: Active) -> Options<Direction, Lines, Consumer>

Configure GPIO lines astive state

Available both for inputs and outputs

source

pub fn bias(self, bias: Bias) -> Options<Direction, Lines, Consumer>

Configure GPIO lines bias

Available both for inputs and outputs

source§

impl<Direction, Lines, Consumer> Options<Direction, Lines, Consumer>
where Lines: AsRef<[u32]>, Consumer: AsRef<str>,

source

pub fn to_owned(&self) -> Options<Direction, Vec<u32>, String>

Make an independent copy of options

source§

impl<Lines, Consumer> Options<Input, Lines, Consumer>

source

pub fn edge(self, edge: EdgeDetect) -> Options<Input, Lines, Consumer>

Configure edge detection

Available only for inputs

source§

impl<Lines, Consumer> Options<Output, Lines, Consumer>

source

pub fn drive(self, drive: Drive) -> Options<Output, Lines, Consumer>

Configure edge detection

Available only for outputs

source

pub fn values<T>(self, values: T) -> Options<Output, Lines, Consumer>
where T: AsValues,

Configure default values

Available only for outputs

Auto Trait Implementations§

§

impl<Direction, Lines, Consumer> Freeze for Options<Direction, Lines, Consumer>
where Lines: Freeze, Consumer: Freeze,

§

impl<Direction, Lines, Consumer> RefUnwindSafe for Options<Direction, Lines, Consumer>
where Lines: RefUnwindSafe, Consumer: RefUnwindSafe, Direction: RefUnwindSafe,

§

impl<Direction, Lines, Consumer> Send for Options<Direction, Lines, Consumer>
where Lines: Send, Consumer: Send, Direction: Send,

§

impl<Direction, Lines, Consumer> Sync for Options<Direction, Lines, Consumer>
where Lines: Sync, Consumer: Sync, Direction: Sync,

§

impl<Direction, Lines, Consumer> Unpin for Options<Direction, Lines, Consumer>
where Lines: Unpin, Consumer: Unpin, Direction: Unpin,

§

impl<Direction, Lines, Consumer> UnwindSafe for Options<Direction, Lines, Consumer>
where Lines: UnwindSafe, Consumer: UnwindSafe, Direction: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.