Skip to main content

output

Function output 

Source
pub fn output(
    chip: impl AsRef<Path>,
    line: u32,
    consumer: &str,
    initial: PinState,
) -> Result<CdevPin, OpenError>
Expand description

Requests a GPIO line as an output.

§Arguments

  • chip - the GPIO chip’s device file, /dev/gpiochip0 on a Raspberry Pi.
  • line - the line offset on that chip, the BCM number on a Raspberry Pi.
  • consumer - the name the kernel shows as holding the line.
  • initial - the level to drive as soon as the line is taken.

§Returns

The line, implementing OutputPin.

§Errors

Returns OpenError::Gpio if the chip or line cannot be opened, or the line is already held by another process or a kernel driver.