Struct gpiocdev_uapi::v2::LineValues
source · [−]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: Bitmap<64>
The value of the lines, set to 1 for active and 0 for inactive.
mask: Bitmap<64>
The lines in a request to access, set to 1 to access and 0 to ignore.
Implementations
sourceimpl 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 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
sourceimpl Clone for LineValues
impl Clone for LineValues
sourcefn clone(&self) -> LineValues
fn clone(&self) -> LineValues
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more