gpio_cdev

Struct Lines

source
pub struct Lines { /* private fields */ }
Expand description

A collection of lines that can be accesses simultaneously

This is a collection of lines, all from the same GPIO chip that can all be accessed simultaneously

Implementations§

source§

impl Lines

source

pub fn chip(&self) -> Chip

Get a handle to the parent chip for the lines

source

pub fn is_empty(&self) -> bool

Get the number of lines in the collection

source

pub fn len(&self) -> usize

Get the number of lines in the collection

source

pub fn request( &self, flags: LineRequestFlags, default: &[u8], consumer: &str, ) -> Result<MultiLineHandle, Error>

Request access to interact with these lines from the kernel

This is similar to the “export” operation present in the sysfs API with the key difference that we are also able to configure the GPIO with flags to specify how the line will be used at the time of request.

For an output, the default parameter specifies the value each line should have when it is configured as an output. The consumer string should describe the process consuming the line (this will be truncated to 31 characters if too long).

§Errors

The main source of errors here is if the kernel returns an error to the ioctl performing the request here. This will result in an Error being returned with ErrorKind::Ioctl.

One possible cause for an error here would be if the lines are already in use. One can check for this prior to making the request using is_kernel.

Trait Implementations§

source§

impl Debug for Lines

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Index<usize> for Lines

source§

type Output = Line

The returned type after indexing.
source§

fn index(&self, i: usize) -> &Line

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl Freeze for Lines

§

impl RefUnwindSafe for Lines

§

impl Send for Lines

§

impl Sync for Lines

§

impl Unpin for Lines

§

impl UnwindSafe for Lines

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>,

source§

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>,

source§

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.