Function gpiocdev::find_named_line
source · [−]Expand description
Find the chip hosting a named line, and the line offset on that chip.
Stops at the first matching line, if one can be found.
Returns the path of the chip containing the line, and the offset of the line on that chip.
If checking that the line name is unique is required then use find_named_lines
with the strict option.
If multiple lines are required then find_named_lines
is more performant.
Examples
The found line can be used to request the line:
let led0 = gpiocdev::find_named_line("LED0").unwrap();
let req = Request::builder()
.with_found_line(&led0)
.as_output(Value::Active)
.request()?;
Using the chip and offset from the found line to request the line:
let led0 = gpiocdev::find_named_line("LED0").unwrap();
let req = Request::builder()
.on_chip(&led0.chip)
.with_line(led0.offset)
.as_output(Value::Active)
.request()?;