Struct gpiod::Chip

source ·
pub struct Chip { /* private fields */ }
Expand description

A Linux chardev GPIO chip interface

It can be used to get information about the chip and lines and to request GPIO lines that can be used as inputs or outputs.

Implementations§

source§

impl Chip

source

pub fn new(device: impl AsDevicePath) -> Result<Chip>

Create a new GPIO chip interface using path

source

pub fn list_devices() -> Result<Vec<PathBuf>>

List all found chips

source

pub fn line_info(&self, line: LineId) -> Result<LineInfo>

Request the info of a specific GPIO line.

source

pub fn request_lines<Direction: DirectionType>( &self, options: Options<Direction, impl AsRef<[LineId]>, impl AsRef<str>> ) -> Result<Lines<Direction>>

Request the GPIO chip to configure the lines passed as argument as inputs or outputs

Calling this operation is a precondition to being able to set the state of the GPIO lines. All the lines passed in one request must share the configured options such as active state, edge detect, GPIO bias, output drive and consumer string.

Methods from Deref<Target = ChipInfo>§

source

pub fn name(&self) -> &str

Get chip name

source

pub fn label(&self) -> &str

Get chip label

source

pub fn num_lines(&self) -> u32

Get number of GPIO lines

Trait Implementations§

source§

impl Deref for Chip

§

type Target = ChipInfo

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Display for Chip

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Chip

§

impl RefUnwindSafe for Chip

§

impl Send for Chip

§

impl Sync for Chip

§

impl Unpin for Chip

§

impl UnwindSafe for Chip

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.