#[repr(C)]pub struct LineValues {
pub bits: u64,
pub mask: u64,
}
Expand description
Values of GPIO lines.
Bits in the bitmaps correspond to the index into LineRequest.offsets
.
The first requested line, offsets[0]
, is bit 0.
Fields§
§bits: u64
The value of the lines, set to 1 for active and 0 for inactive.
mask: u64
The lines in a request to access, set to 1 to access and 0 to ignore.
Implementations§
Source§impl LineValues
impl LineValues
Sourcepub fn from_slice(s: &[bool]) -> Self
pub fn from_slice(s: &[bool]) -> Self
Create values from a slice.
The values are in the same order as LineRequest.offsets
.
Sourcepub fn copy_from_slice(&mut self, s: &[bool])
pub fn copy_from_slice(&mut self, s: &[bool])
Copy values from an iterable list - in order of requested offsets.
Sourcepub fn get(&self, idx: usize) -> Option<bool>
pub fn get(&self, idx: usize) -> Option<bool>
Return the value of a line.
Note that the LineValues
need to be populated via a call to get_line_values
to get values from the underlying hardware.
Fails if the line of interest is not set in the mask.
idx
- The index into theLineRequest.offsets
for the line of interest.
Sourcepub fn set(&mut self, idx: usize, active: bool)
pub fn set(&mut self, idx: usize, active: bool)
Set the value of a line.
Note that the values are not applied to hardware until passed to set_line_values
.
idx
- The index into theLineRequest.offsets
for the line of interest.active
- The logical state of the line to be set.
Sourcepub fn unset_mask(&mut self, idx: usize)
pub fn unset_mask(&mut self, idx: usize)
Clear the mask bit for a line.
The line will be ignored in subsequent calls to get_line_values
and
set_line_values
.
idx
- The index into theLineRequest.offsets
for the line of interest.
Trait Implementations§
Source§impl Clone for LineValues
impl Clone for LineValues
Source§fn clone(&self) -> LineValues
fn clone(&self) -> LineValues
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more