pub struct Chip { /* private fields */ }
Expand description
A GPIO character device.
Implementations
sourceimpl Chip
impl Chip
sourcepub fn from_path<P: AsRef<Path>>(p: P) -> Result<Chip>
pub fn from_path<P: AsRef<Path>>(p: P) -> Result<Chip>
Constructs a Chip using the given path.
The path must resolve to a valid GPIO character device.
sourcepub fn from_name(n: &str) -> Result<Chip>
pub fn from_name(n: &str) -> Result<Chip>
Constructs a Chip using the given name.
The name must resolve to a valid GPIO character device.
sourcepub fn name(&self) -> String
pub fn name(&self) -> String
Return the name of the chip.
This is based on the filename component of the resolved chip path, not the name
from the Info
, so it does not involve any system calls.
sourcepub fn find_line_info(&self, name: &str) -> Option<Info>
pub fn find_line_info(&self, name: &str) -> Option<Info>
Find the info for the named line.
Returns the first matching line.
sourcepub fn line_info(&self, offset: Offset) -> Result<Info>
pub fn line_info(&self, offset: Offset) -> Result<Info>
Get the information for a line on the chip.
sourcepub fn line_info_iter(&self) -> Result<LineInfoIterator<'_>>
pub fn line_info_iter(&self) -> Result<LineInfoIterator<'_>>
An iterator that returns the info for each line on the chip.
sourcepub fn watch_line_info(&self, offset: Offset) -> Result<Info>
pub fn watch_line_info(&self, offset: Offset) -> Result<Info>
Add a watch for changes to the publicly available information on a line.
This is a null operation if there is already a watch on the line.
sourcepub fn unwatch_line_info(&self, offset: Offset) -> Result<()>
pub fn unwatch_line_info(&self, offset: Offset) -> Result<()>
Remove a watch for changes to the publicly available information on a line.
This is a null operation if there is no existing watch on the line.
sourcepub fn has_line_info_change_event(&self) -> Result<bool>
pub fn has_line_info_change_event(&self) -> Result<bool>
Check if the request has at least one info change event available to read.
sourcepub fn wait_line_info_change_event(&self, timeout: Duration) -> Result<bool>
pub fn wait_line_info_change_event(&self, timeout: Duration) -> Result<bool>
Wait for an info change event to be available.
sourcepub fn read_line_info_change_event(&self) -> Result<InfoChangeEvent>
pub fn read_line_info_change_event(&self) -> Result<InfoChangeEvent>
Read a single line info change event from the chip.
Will block until an edge event is available.
sourcepub fn info_change_events(&self) -> InfoChangeIterator<'_>ⓘNotable traits for InfoChangeIterator<'a>impl<'a> Iterator for InfoChangeIterator<'a> type Item = Result<InfoChangeEvent>;
pub fn info_change_events(&self) -> InfoChangeIterator<'_>ⓘNotable traits for InfoChangeIterator<'a>impl<'a> Iterator for InfoChangeIterator<'a> type Item = Result<InfoChangeEvent>;
An iterator for info change events from the chip.
sourcepub fn detect_abi_version(&self) -> Result<AbiVersion>
pub fn detect_abi_version(&self) -> Result<AbiVersion>
Detect the most recent uAPI ABI supported by the library for the chip.
sourcepub fn supports_abi_version(&self, abiv: AbiVersion) -> Result<()>
pub fn supports_abi_version(&self, abiv: AbiVersion) -> Result<()>
Check if the platform and library support a specific ABI version.